diff --git a/app/app.go b/app/app.go index 20cae2c..cc0ccdd 100644 --- a/app/app.go +++ b/app/app.go @@ -941,6 +941,10 @@ func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.Res panic(err) } + genesisInfo := app.HubGenesisKeeper.GetGenesisInfo(ctx) + genesisInfo.GenesisChecksum = req.GenesisChecksum + app.HubGenesisKeeper.SetGenesisInfo(ctx, genesisInfo) + // Passing the dymint sequencers to the sequencer module from RequestInitChain if len(req.Validators) == 0 { panic(fmt.Sprint("Dymint have no sequencers defined on InitChain, req:", req)) diff --git a/go.mod b/go.mod index 1f911dd..2f2e6e6 100644 --- a/go.mod +++ b/go.mod @@ -15,8 +15,8 @@ require ( github.com/cosmos/gogoproto v1.5.0 github.com/cosmos/ibc-go/v6 v6.3.0 github.com/dvsekhvalnov/jose2go v1.5.0 - github.com/dymensionxyz/dymension-rdk v1.6.1-0.20241030213845-88f668faab66 - github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241031114544-58b9cafae18c + github.com/dymensionxyz/dymension-rdk v1.6.1-0.20241104174622-ef99c12f13b4 + github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241104173413-6ae1dc10f0bf github.com/ethereum/go-ethereum v1.12.0 github.com/evmos/evmos/v12 v12.1.6 github.com/gogo/protobuf v1.3.3 @@ -360,5 +360,5 @@ replace ( // replace broken goleveldb github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // use cometbft - github.com/tendermint/tendermint => github.com/dymensionxyz/cometbft v0.34.29-0.20241030154748-3f9dfa21d17b + github.com/tendermint/tendermint => github.com/dymensionxyz/cometbft v0.34.29-0.20241104165035-feade34f8f89 ) diff --git a/go.sum b/go.sum index 073227c..5091fd0 100644 --- a/go.sum +++ b/go.sum @@ -569,14 +569,14 @@ 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/dymensionxyz/cometbft v0.34.29-0.20241030154748-3f9dfa21d17b h1:rxkH+9cBG2nnReMavb2FqQXwDLjKcz0/KB8/6SV5Xlo= -github.com/dymensionxyz/cometbft v0.34.29-0.20241030154748-3f9dfa21d17b/go.mod h1:L9shMfbkZ8B+7JlwANEr+NZbBcn+hBpwdbeYvA5rLCw= +github.com/dymensionxyz/cometbft v0.34.29-0.20241104165035-feade34f8f89 h1:rGkCcx4dWX9mxAUrq7zrdOc44XddMY/nM6kqYTWjerY= +github.com/dymensionxyz/cometbft v0.34.29-0.20241104165035-feade34f8f89/go.mod h1:L9shMfbkZ8B+7JlwANEr+NZbBcn+hBpwdbeYvA5rLCw= github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240821081230-b4018b2bac13 h1:u5yeve5jZR6TdRjjR+vYT/8PWKbhwCZxUmAu+/Tnxyg= github.com/dymensionxyz/cosmosclient v0.4.2-beta.0.20240821081230-b4018b2bac13/go.mod h1:jabDQYXrccscSE0fXkh7eQFYPWJCRiuWKonFGObVq6s= -github.com/dymensionxyz/dymension-rdk v1.6.1-0.20241030213845-88f668faab66 h1:6fcEO/tyf9bKsyCA/x0nSo5gMig7HDUme2xFqMorkpc= -github.com/dymensionxyz/dymension-rdk v1.6.1-0.20241030213845-88f668faab66/go.mod h1:HH7sGM/4MSI8OLces8axABf7K0ppXNok+G2nxC/l5YI= -github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241031114544-58b9cafae18c h1:NiIwXgG8vbPh1a/mRqLK4wOf7W1jvc5Cm4aOCEvx7z8= -github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241031114544-58b9cafae18c/go.mod h1:BTc0Br+c1YyBGeI1O1inU+pxeifDnyzz/Muu/dgDUKI= +github.com/dymensionxyz/dymension-rdk v1.6.1-0.20241104174622-ef99c12f13b4 h1:3R7XqM0Hstb9GxZtuijarVSXTEDu24ywlyFUCjCT9sQ= +github.com/dymensionxyz/dymension-rdk v1.6.1-0.20241104174622-ef99c12f13b4/go.mod h1:y89w1OG4C4aF7yyW8bv9PwV3o1KkCx1hyt34ap04Rnk= +github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241104173413-6ae1dc10f0bf h1:2ChqhjDO12ggf4Xh7dovYamrJlF3eyGIh3co0PAMsVk= +github.com/dymensionxyz/dymint v1.2.0-rc01.0.20241104173413-6ae1dc10f0bf/go.mod h1:Qc4FqIlTdIUROQIS0mkIWF5wA6C4AM6znoDKzkHJ5EY= github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.4.2 h1:aVP3off7u2vsvRH7lHAUPTLdf9/AfnzC/rvvi0wC/co= github.com/dymensionxyz/evmos/v12 v12.1.6-dymension-v0.4.2/go.mod h1:CI6D89pkoiIm4BjoMFNnEaCLdKBEobLuwvhS0c1zh7Y= github.com/dymensionxyz/gerr-cosmos v1.0.0 h1:oi91rgOkpJWr41oX9JOyjvvBnhGY54tj513x8VlDAEc= diff --git a/rollappd/cmd/root.go b/rollappd/cmd/root.go index 5807276..e97a580 100644 --- a/rollappd/cmd/root.go +++ b/rollappd/cmd/root.go @@ -194,6 +194,7 @@ func queryCommand() *cobra.Command { rpc.BlockCommand(), authcmd.QueryTxsByEventsCmd(), authcmd.QueryTxCmd(), + genesisChecksumCmd(), ) app.ModuleBasics.AddQueryCommands(cmd) diff --git a/rollappd/cmd/start.go b/rollappd/cmd/start.go index 7fa75ae..de8893a 100644 --- a/rollappd/cmd/start.go +++ b/rollappd/cmd/start.go @@ -47,6 +47,7 @@ import ( "github.com/dymensionxyz/dymension-rdk/utils" rdklogger "github.com/dymensionxyz/dymension-rdk/utils/logger" + "github.com/dymensionxyz/dymint/cmd/dymint/commands" dymintconf "github.com/dymensionxyz/dymint/config" dymintconv "github.com/dymensionxyz/dymint/conv" dymintmemp "github.com/dymensionxyz/dymint/mempool" @@ -300,6 +301,11 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, nodeConfig *d return err } + genesisChecksum, err := commands.ComputeGenesisHash(cfg.GenesisFile()) + if err != nil { + return fmt.Errorf("failed to compute genesis checksum: %w", err) + } + ctx.Logger.Info("starting node with ABCI dymint in-process") tmNode, err := dymintnode.NewNode( context.Background(), @@ -308,6 +314,7 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, nodeConfig *d signingKey, proxy.NewLocalClientCreator(app), genesis, + genesisChecksum, ctx.Logger, dymintmemp.PrometheusMetrics("dymint"), ) @@ -596,3 +603,23 @@ func wrapCPUProfile(ctx *server.Context, callback func() error) error { return <-errCh } + +func genesisChecksumCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "genesis-checksum", + Short: "Compute the checksum of the genesis file", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + serverCtx := server.GetServerContextFromCmd(cmd) + checksum, err := commands.ComputeGenesisHash(serverCtx.Config.GenesisFile()) + if err != nil { + return err + } + + fmt.Println(checksum) + return nil + }, + } + + return cmd +} diff --git a/scripts/settlement/register_rollapp_to_hub.sh b/scripts/settlement/register_rollapp_to_hub.sh index ca40d51..f5466d4 100644 --- a/scripts/settlement/register_rollapp_to_hub.sh +++ b/scripts/settlement/register_rollapp_to_hub.sh @@ -106,8 +106,7 @@ EOF fi -GENESIS_PATH="${ROLLAPP_HOME_DIR}/config/genesis.json" -GENESIS_HASH=$(sha256sum "$GENESIS_PATH" | awk '{print $1}' | sed 's/[[:space:]]*$//') +GENESIS_HASH=$($EXECUTABLE q genesis-checksum) SEQUENCER_ADDR=$(dymd keys show "$SEQUENCER_KEY_NAME" --address --keyring-backend test --keyring-dir "$SEQUENCER_KEY_PATH") echo "deployer" $DEPLOYER;