Skip to content

Instantly share code, notes, and snippets.

@freak12techno
Created April 20, 2024 18:34
Show Gist options
  • Save freak12techno/845a3061ed65295667c145c05ffd3b23 to your computer and use it in GitHub Desktop.
Save freak12techno/845a3061ed65295667c145c05ffd3b23 to your computer and use it in GitHub Desktop.
package main
import (
"cosmossdk.io/log"
"cosmossdk.io/store"
"cosmossdk.io/store/metrics"
"cosmossdk.io/store/rootmulti"
"fmt"
dbm "github.com/cosmos/cosmos-db"
"os"
)
func main() {
if len(os.Args) != 2 {
panic("please provide exactly 1 path to node's data folder")
}
db, err := dbm.NewDB("application", dbm.GoLevelDBBackend, os.Args[1])
if err != nil {
panic(err)
}
multistoreRaw := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics())
multistore := multistoreRaw.(*rootmulti.Store)
version := multistore.LatestVersion()
commitInfo, err := multistore.GetCommitInfo(version)
if err != nil {
panic(err)
}
fmt.Printf("got commitInfo with %d stores\n", len(commitInfo.StoreInfos))
for index, storeInfo := range commitInfo.StoreInfos {
fmt.Printf(" index %d: store name %s, hash %x\n", index, storeInfo.Name, storeInfo.GetHash())
}
fmt.Printf("hash: %x\n", commitInfo.Hash())
}
@freak12techno
Copy link
Author

freak12techno commented Apr 20, 2024

installing:

# creating a folder for the script
mkdir apphash-calculator
cd apphash-calculator
# init modules structure
go mod init main
# download modules
go mod tidy
# run a script
go run main.go <path-to-node-data-folder>

and stop your node before the last step (running the script) as otherwise you'd get the database temporarily unavailable error

@xbdyhh
Copy link

xbdyhh commented Apr 21, 2024

validator panxinynag gist:

got commitInfo with 27 stores
index 0: store name acc, hash 9e1302b91eaf8425f73e3d42826ed2bd4267f8023ac007276a79f74dfa04c5ae
index 1: store name bank, hash e072208b94034c276d1ac72fd072561ee00a9908a2e100078581a32630b4183c
index 2: store name capability, hash d5089edeb8aaec7861fde339a8e6eded3c05cd3a9c5fd99d765ed9ab8894a19d
index 3: store name consensus, hash 35760e4a68fbc1cdd5b3b181b90d04f51390a0aa55476cdb40924d1494bf3d1d
index 4: store name crisis, hash fcdbed88c4f469a6d65b45b70b50d22def35d5a5a73c8c371b42f9258c96b07c
index 5: store name distribution, hash 3c3a20541cd542047df6fefacbbeb409b70d245860707316aceba9a214d6b9df
index 6: store name evidence, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
index 7: store name evm, hash d0f70ebc81c1eeb7de08619b744d21be7c5d3425f51d563af649d7fe702e875a
index 8: store name feegrant, hash e611d96b3ac60d414fffbf7042e762dfe3f2fdefa993b92f1c0b15817883c306
index 9: store name feeibc, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
index 10: store name gov, hash 8b061c8c6f26a6c1bd3960018189a0f87e567f1231a38798d09c329914d29070
index 11: store name gravity2, hash 067547ee5229d8cd7dc70161935da57865aabc134ec09c35ba4c7812834b2aaf
index 12: store name ibc, hash 1db3bc7eabb97e9bfaab6711b3ff0f62fdf23996fba4293a854ed8c700ae726f
index 13: store name icacontroller, hash e6399686154575bfc1838d859d1dd80d68be24b6bf5d5e5d03b1a98d4f58b3de
index 14: store name icahost, hash b668b79d49a94cb5b1969c9c17e7aecd0cd5dd05d19e7c6335ca102877d3fab9
index 15: store name metrix, hash f0874505569364d3fdf3bc11b252475b084cedcfac2e832d0f5f38e263d1e894
index 16: store name mint, hash 5db8f6ef67a53303d2981e8c416fb9bcdeb6fa9ddecfb1592116dc3a1aa52367
index 17: store name palomaconsensus, hash 2d289f730c19614e2046965196ecda43787e997e1d1b6d29bb68b7ca867b2ca6
index 18: store name params, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
index 19: store name scheduler, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
index 20: store name slashing, hash 9f6dfc2e006d0ac8fb8f0cc0d2724ba442dc9dd6703ec8b9ed94591bf7819a28
index 21: store name staking, hash 0192802d861db695baa7d6fab6ccf2fc0e971cfbbc681835e714bc6f9662b5a6
index 22: store name transfer, hash 90fdae9ef2124b88045deea846624eed6bc9e5e5422fada847b882fb66d81f17
index 23: store name treasury, hash a173fc8ffe5686dd29997e03c8cbd8caff72ae7901932aa0c3864972caa2f4c6
index 24: store name upgrade, hash 52cf93ac87c7ad747db9a295c8e36c5dfec395fe7252ab8f8024f54eed1abed2
index 25: store name valset, hash 9a7d75a6fd18c8b76fbf36d75dbc8a5fad79230c384d5d88ca35922d933f7d8b
index 26: store name wasm, hash 89db7cf4549ddb2dbe31ac1fcb2d9833aeb1e415e846e0844172dd75c521ec6d
hash: 962e13ee35f0dbedb69c243062c68d67c025bb6da953290f0e03c2fa5c18ddc7

@taariq
Copy link

taariq commented Apr 21, 2024

From RektDAO

got commitInfo with 27 stores
index 0: store name acc, hash 9e1302b91eaf8425f73e3d42826ed2bd4267f8023ac007276a79f74dfa04c5ae
index 1: store name bank, hash e072208b94034c276d1ac72fd072561ee00a9908a2e100078581a32630b4183c
index 2: store name capability, hash d5089edeb8aaec7861fde339a8e6eded3c05cd3a9c5fd99d765ed9ab8894a19d
index 3: store name consensus, hash 35760e4a68fbc1cdd5b3b181b90d04f51390a0aa55476cdb40924d1494bf3d1d
index 4: store name crisis, hash fcdbed88c4f469a6d65b45b70b50d22def35d5a5a73c8c371b42f9258c96b07c
index 5: store name distribution, hash 7991dd15c402877dcdef9bdfe3118ad2769fc6a3a5384bc74923934524758f0b
index 6: store name evidence, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
index 7: store name evm, hash d0f70ebc81c1eeb7de08619b744d21be7c5d3425f51d563af649d7fe702e875a
index 8: store name feegrant, hash e611d96b3ac60d414fffbf7042e762dfe3f2fdefa993b92f1c0b15817883c306
index 9: store name feeibc, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
index 10: store name gov, hash 8b061c8c6f26a6c1bd3960018189a0f87e567f1231a38798d09c329914d29070
index 11: store name gravity2, hash 067547ee5229d8cd7dc70161935da57865aabc134ec09c35ba4c7812834b2aaf
index 12: store name ibc, hash 1db3bc7eabb97e9bfaab6711b3ff0f62fdf23996fba4293a854ed8c700ae726f
index 13: store name icacontroller, hash e6399686154575bfc1838d859d1dd80d68be24b6bf5d5e5d03b1a98d4f58b3de
index 14: store name icahost, hash b668b79d49a94cb5b1969c9c17e7aecd0cd5dd05d19e7c6335ca102877d3fab9
index 15: store name metrix, hash f0874505569364d3fdf3bc11b252475b084cedcfac2e832d0f5f38e263d1e894
index 16: store name mint, hash 5db8f6ef67a53303d2981e8c416fb9bcdeb6fa9ddecfb1592116dc3a1aa52367
index 17: store name palomaconsensus, hash 2d289f730c19614e2046965196ecda43787e997e1d1b6d29bb68b7ca867b2ca6
index 18: store name params, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
index 19: store name scheduler, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
index 20: store name slashing, hash 9f6dfc2e006d0ac8fb8f0cc0d2724ba442dc9dd6703ec8b9ed94591bf7819a28
index 21: store name staking, hash 0192802d861db695baa7d6fab6ccf2fc0e971cfbbc681835e714bc6f9662b5a6
index 22: store name transfer, hash 90fdae9ef2124b88045deea846624eed6bc9e5e5422fada847b882fb66d81f17
index 23: store name treasury, hash a173fc8ffe5686dd29997e03c8cbd8caff72ae7901932aa0c3864972caa2f4c6
index 24: store name upgrade, hash 52cf93ac87c7ad747db9a295c8e36c5dfec395fe7252ab8f8024f54eed1abed2
index 25: store name valset, hash 9a7d75a6fd18c8b76fbf36d75dbc8a5fad79230c384d5d88ca35922d933f7d8b
index 26: store name wasm, hash 89db7cf4549ddb2dbe31ac1fcb2d9833aeb1e415e846e0844172dd75c521ec6d
hash: b2119d90e37d8e784ad2d59e76440732d9986d3ece1f1840a385bcd6595cc794

@taariq
Copy link

taariq commented Apr 21, 2024

The difference is coming from 5: store name distribution

  1. RektDAO: hash 7991dd15c402877dcdef9bdfe3118ad2769fc6a3a5384bc74923934524758f0b
  2. panxinyang: hash 3c3a20541cd542047df6fefacbbeb409b70d245860707316aceba9a214d6b9df

@vbloher
Copy link

vbloher commented Apr 22, 2024

Results for NODEJUMPER validator node

got commitInfo with 27 stores
 index 0: store name acc, hash 9e1302b91eaf8425f73e3d42826ed2bd4267f8023ac007276a79f74dfa04c5ae
 index 1: store name bank, hash e072208b94034c276d1ac72fd072561ee00a9908a2e100078581a32630b4183c
 index 2: store name capability, hash d5089edeb8aaec7861fde339a8e6eded3c05cd3a9c5fd99d765ed9ab8894a19d
 index 3: store name consensus, hash 35760e4a68fbc1cdd5b3b181b90d04f51390a0aa55476cdb40924d1494bf3d1d
 index 4: store name crisis, hash fcdbed88c4f469a6d65b45b70b50d22def35d5a5a73c8c371b42f9258c96b07c
 index 5: store name distribution, hash 3c3a20541cd542047df6fefacbbeb409b70d245860707316aceba9a214d6b9df
 index 6: store name evidence, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
 index 7: store name evm, hash d0f70ebc81c1eeb7de08619b744d21be7c5d3425f51d563af649d7fe702e875a
 index 8: store name feegrant, hash e611d96b3ac60d414fffbf7042e762dfe3f2fdefa993b92f1c0b15817883c306
 index 9: store name feeibc, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
 index 10: store name gov, hash 8b061c8c6f26a6c1bd3960018189a0f87e567f1231a38798d09c329914d29070
 index 11: store name gravity2, hash 067547ee5229d8cd7dc70161935da57865aabc134ec09c35ba4c7812834b2aaf
 index 12: store name ibc, hash 1db3bc7eabb97e9bfaab6711b3ff0f62fdf23996fba4293a854ed8c700ae726f
 index 13: store name icacontroller, hash e6399686154575bfc1838d859d1dd80d68be24b6bf5d5e5d03b1a98d4f58b3de
 index 14: store name icahost, hash b668b79d49a94cb5b1969c9c17e7aecd0cd5dd05d19e7c6335ca102877d3fab9
 index 15: store name metrix, hash f0874505569364d3fdf3bc11b252475b084cedcfac2e832d0f5f38e263d1e894
 index 16: store name mint, hash 5db8f6ef67a53303d2981e8c416fb9bcdeb6fa9ddecfb1592116dc3a1aa52367
 index 17: store name palomaconsensus, hash 2d289f730c19614e2046965196ecda43787e997e1d1b6d29bb68b7ca867b2ca6
 index 18: store name params, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
 index 19: store name scheduler, hash e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
 index 20: store name slashing, hash 9f6dfc2e006d0ac8fb8f0cc0d2724ba442dc9dd6703ec8b9ed94591bf7819a28
 index 21: store name staking, hash 0192802d861db695baa7d6fab6ccf2fc0e971cfbbc681835e714bc6f9662b5a6
 index 22: store name transfer, hash 90fdae9ef2124b88045deea846624eed6bc9e5e5422fada847b882fb66d81f17
 index 23: store name treasury, hash a173fc8ffe5686dd29997e03c8cbd8caff72ae7901932aa0c3864972caa2f4c6
 index 24: store name upgrade, hash 52cf93ac87c7ad747db9a295c8e36c5dfec395fe7252ab8f8024f54eed1abed2
 index 25: store name valset, hash 9a7d75a6fd18c8b76fbf36d75dbc8a5fad79230c384d5d88ca35922d933f7d8b
 index 26: store name wasm, hash 89db7cf4549ddb2dbe31ac1fcb2d9833aeb1e415e846e0844172dd75c521ec6d
hash: 962e13ee35f0dbedb69c243062c68d67c025bb6da953290f0e03c2fa5c18ddc7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment