diff --git a/.gitignore b/.gitignore index 195c68db..23c5a508 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ build/linux go.work go.work.sum .build/0gchaind +.build/da diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index 2a611f92..125ebf14 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -6,10 +6,12 @@ import ( "testing" "time" + sdkmath "cosmossdk.io/math" tmdb "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/app/app.go b/app/app.go index 269487e5..d0a532f2 100644 --- a/app/app.go +++ b/app/app.go @@ -627,6 +627,8 @@ func NewApp( validatorvesting.NewAppModule(app.bankKeeper), evmutil.NewAppModule(app.evmutilKeeper, app.bankKeeper, app.accountKeeper), mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper, nil, mintSubspace), + council.NewAppModule(app.CouncilKeeper, app.stakingKeeper), + das.NewAppModule(app.DasKeeper), ) // Warning: Some begin blockers must run before others. Ensure the dependencies are understood before modifying this list. diff --git a/cmd/0gchaind/root.go b/cmd/0gchaind/root.go index 575b2d45..fe285cf6 100644 --- a/cmd/0gchaind/root.go +++ b/cmd/0gchaind/root.go @@ -8,6 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" tmcfg "github.com/cometbft/cometbft/config" @@ -28,8 +29,16 @@ import ( "github.com/0glabs/0g-chain/chaincfg" "github.com/0glabs/0g-chain/cmd/opendb" "github.com/0glabs/0g-chain/cmd/rocksdb" + "github.com/0glabs/0g-chain/crypto/vrf" ) +func customKeyringOptions() keyring.Option { + return func(options *keyring.Options) { + options.SupportedAlgos = append(hd.SupportedAlgorithms, vrf.VrfAlgo) + options.SupportedAlgosLedger = append(hd.SupportedAlgorithmsLedger, vrf.VrfAlgo) + } +} + // NewRootCmd creates a new root command for the 0g-chain blockchain. func NewRootCmd() *cobra.Command { encodingConfig := app.MakeEncodingConfig() @@ -42,7 +51,7 @@ func NewRootCmd() *cobra.Command { WithAccountRetriever(types.AccountRetriever{}). WithBroadcastMode(flags.FlagBroadcastMode). WithHomeDir(chaincfg.DefaultNodeHome). - WithKeyringOptions(hd.EthSecp256k1Option()). + WithKeyringOptions(customKeyringOptions()). WithViper(chaincfg.EnvPrefix) rootCmd := &cobra.Command{ Use: chaincfg.AppName, diff --git a/helper/da/client/client.go b/helper/da/client/client.go index 533c9e9c..0d760d6b 100644 --- a/helper/da/client/client.go +++ b/helper/da/client/client.go @@ -4,7 +4,7 @@ import ( "context" "time" - "github.com/0glabs/0g-evmos/helper/da/light" + "github.com/0glabs/0g-chain/helper/da/light" "github.com/pkg/errors" ) diff --git a/helper/da/go.mod b/helper/da/go.mod index b0e11e7e..c42d6564 100644 --- a/helper/da/go.mod +++ b/helper/da/go.mod @@ -1,4 +1,4 @@ -module github.com/0glabs/0g-evmos/helper/da +module github.com/0glabs/0g-chain/helper/da go 1.20 diff --git a/helper/da/main.go b/helper/da/main.go index 001737a8..247f4e16 100644 --- a/helper/da/main.go +++ b/helper/da/main.go @@ -11,8 +11,8 @@ import ( "os/signal" "time" - "github.com/0glabs/0g-evmos/helper/da/service" - "github.com/0glabs/0g-evmos/helper/da/types" + "github.com/0glabs/0g-chain/helper/da/service" + "github.com/0glabs/0g-chain/helper/da/types" "github.com/lesismal/nbio/nbhttp" "github.com/lesismal/nbio/nbhttp/websocket" diff --git a/helper/da/service/handler.go b/helper/da/service/handler.go index e7f5d19f..5a379bc8 100644 --- a/helper/da/service/handler.go +++ b/helper/da/service/handler.go @@ -8,9 +8,9 @@ import ( "strconv" "strings" - "github.com/0glabs/0g-evmos/helper/da/client" - "github.com/0glabs/0g-evmos/helper/da/types" - "github.com/0glabs/0g-evmos/helper/da/utils/sizedw8grp" + "github.com/0glabs/0g-chain/helper/da/client" + "github.com/0glabs/0g-chain/helper/da/types" + "github.com/0glabs/0g-chain/helper/da/utils/sizedw8grp" jsoniter "github.com/json-iterator/go" "github.com/lesismal/nbio/nbhttp/websocket" @@ -165,20 +165,20 @@ func runEvmosdCliReportDasResult(ctx context.Context, requestId uint64, result b strconv.FormatUint(requestId, 10), strconv.FormatBool(result), "--from", account.(string), - "--gas-prices", "767812500aevmos", // TODO: use args to set gas prices + "--gas-prices", "7678500neuron", // TODO: use args to set gas prices } homePath := ctx.Value(types.NODE_HOME_PATH) - if homePath != nil { + if len(homePath.(string)) > 0 { args = append(args, "--home", homePath.(string)) } keyring := ctx.Value(types.NODE_CLI_EXEC_KEYRING) - if keyring != nil { + if len(keyring.(string)) > 0 { args = append(args, "--keyring-backend", keyring.(string)) } - cmdStr := relativePath.(string) + "evmosd" + cmdStr := relativePath.(string) + "0gchaind" cmd := exec.Command(cmdStr, append(args, "-y")...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr diff --git a/x/council/v1/client/cli/tx.go b/x/council/v1/client/cli/tx.go index 627e12a7..31f12d0e 100644 --- a/x/council/v1/client/cli/tx.go +++ b/x/council/v1/client/cli/tx.go @@ -166,13 +166,15 @@ func NewVoteCmd() *cobra.Command { var tokens sdkmath.Int for _, val := range rsp.Hist.Valset { thisValAddr := val.GetOperator() + if thisValAddr.Equals(valAddr) { tokens = val.GetTokens() } } - + // the denom of token is neuron, need to convert to A0GI + a0gi := tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000)) // 1_000 0AGI token / vote - numBallots := tokens.Quo(sdk.NewInt(1_000_000_000_000_000_000)).Quo(sdk.NewInt(1_000)).Uint64() + numBallots := a0gi.Quo(sdk.NewInt(1_000)).Uint64() ballots := make([]*types.Ballot, numBallots) for i := range ballots { ballotID := uint64(i)