Skip to content

Commit

Permalink
refactor(rename): rename iliad to story (#13)
Browse files Browse the repository at this point in the history
* replace Iliad to Story

* replace lower case iliad with lower case story

* rename toml file
  • Loading branch information
edisonz0718 authored Aug 22, 2024
1 parent b80868e commit dd39b7c
Show file tree
Hide file tree
Showing 51 changed files with 173 additions and 172 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-s3.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Upload iliad Binary
name: Build and Upload story Binary

on:
workflow_dispatch:
Expand Down Expand Up @@ -27,7 +27,7 @@ jobs:
Timestamp:
uses: storyprotocol/gha-workflows/.github/workflows/reusable-timestamp.yml@main

# Build and upload the iliad binary
# Build and upload the story binary
build_and_push:
needs: Timestamp
runs-on: ubuntu-latest
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
mkdir $FOLDER_NAME
mv $BIN_NAME_WITH_PATH $FOLDER_NAME/
echo "Archiving the iliad binary..."
echo "Archiving the story binary..."
tar -czvf $ARCHIVE_NAME $FOLDER_NAME
if [ $? -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion client/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
)

const Name = "iliad"
const Name = "story"

var (
_ runtime.AppI = (*App)(nil)
Expand Down
4 changes: 2 additions & 2 deletions client/app/cmtlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ var dropCometDebugs = map[string]bool{
"Send": true,
}

// cmtLogger implements cmtlog.Logger by using the iliad logging pattern.
// cmtLogger implements cmtlog.Logger by using the story logging pattern.
// Comet log level is controlled separately in config.toml, since comet logs are very noisy.
type cmtLogger struct {
ctx context.Context //nolint:containedctx // This is a wrapper around the iliad logger which is context based.
ctx context.Context //nolint:containedctx // This is a wrapper around the story logger which is context based.
level int
}

Expand Down
2 changes: 1 addition & 1 deletion client/app/keepers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Keepers struct {
GovKeeper *govkeeper.Keeper
UpgradeKeeper *upgradekeeper.Keeper

// Iliad
// Story
EvmStakingKeeper *evmstakingkeeper.Keeper
EVMEngKeeper *evmengkeeper.Keeper
}
4 changes: 2 additions & 2 deletions client/app/sdklog.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ var dropCosmosDebugs = map[string]bool{
"SAVE TREE": true,
}

// sdkLogger implements sdklog.Logger by using the iliad logging pattern.
// sdkLogger implements sdklog.Logger by using the story logging pattern.
// Comet log level is controlled separately in config.toml, since comet logs are very noisy.
type sdkLogger struct {
ctx context.Context //nolint:containedctx // This is a wrapper around the iliad logger which is context based.
ctx context.Context //nolint:containedctx // This is a wrapper around the story logger which is context based.
}

func newSDKLogger(ctx context.Context) sdkLogger {
Expand Down
18 changes: 9 additions & 9 deletions client/app/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/mempool"

"github.com/piplabs/story/client/comet"
iliadcfg "github.com/piplabs/story/client/config"
storycfg "github.com/piplabs/story/client/config"
apisvr "github.com/piplabs/story/client/server"
"github.com/piplabs/story/lib/buildinfo"
"github.com/piplabs/story/lib/errors"
Expand All @@ -33,13 +33,13 @@ import (
"github.com/piplabs/story/lib/tracer"
)

// Config wraps the iliad (app) and comet (client) configurations.
// Config wraps the story (app) and comet (client) configurations.
type Config struct {
iliadcfg.Config
storycfg.Config
Comet cmtcfg.Config
}

// BackendType returns the iliad config backend type
// BackendType returns the story config backend type
// or the comet backend type otherwise.
func (c Config) BackendType() dbm.BackendType {
if c.Config.BackendType == "" {
Expand All @@ -49,7 +49,7 @@ func (c Config) BackendType() dbm.BackendType {
return dbm.BackendType(c.Config.BackendType)
}

// Run runs the iliad client until the context is canceled.
// Run runs the story client until the context is canceled.
//
//nolint:contextcheck // Explicit new stop context.
func Run(ctx context.Context, cfg Config) error {
Expand All @@ -68,20 +68,20 @@ func Run(ctx context.Context, cfg Config) error {
return stopFunc(stopCtx)
}

// Start starts the iliad client returning a stop function or an error.
// Start starts the story client returning a stop function or an error.
//
// Note that the original context used to start the app must be canceled first
// before calling the stop function and a fresh context should be passed into the stop function.
func Start(ctx context.Context, cfg Config) (func(context.Context) error, error) {
log.Info(ctx, "Starting iliad consensus client")
log.Info(ctx, "Starting story consensus client")

if err := cfg.Verify(); err != nil {
return nil, errors.Wrap(err, "verify iliad config")
return nil, errors.Wrap(err, "verify story config")
}

buildinfo.Instrument(ctx)

tracerIDs := tracer.Identifiers{Network: cfg.Network, Service: "iliad", Instance: cfg.Comet.Moniker}
tracerIDs := tracer.Identifiers{Network: cfg.Network, Service: "story", Instance: cfg.Comet.Moniker}
stopTracer, err := tracer.Init(ctx, tracerIDs, cfg.Tracer)
if err != nil {
return nil, err
Expand Down
20 changes: 10 additions & 10 deletions client/cmd/cmd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package cmd provides the cli for running the iliad consensus client.
// Package cmd provides the cli for running the story consensus client.
package cmd

import (
Expand All @@ -7,7 +7,7 @@ import (
"github.com/spf13/cobra"

"github.com/piplabs/story/client/app"
iliadcfg "github.com/piplabs/story/client/config"
storycfg "github.com/piplabs/story/client/config"
"github.com/piplabs/story/lib/buildinfo"
libcmd "github.com/piplabs/story/lib/cmd"
"github.com/piplabs/story/lib/log"
Expand All @@ -16,23 +16,23 @@ import (
// New returns a new root cobra command that handles our command line tool.
func New() *cobra.Command {
return libcmd.NewRootCmd(
"iliad",
"Iliad is a consensus client implementation for the Story L1 blockchain",
"story",
"Story is a consensus client implementation for the Story L1 blockchain",
newRunCmd("run", app.Run),
newInitCmd(),
buildinfo.NewVersionCmd(),
newValidatorCmds(),
)
}

// newRunCmd returns a new cobra command that runs the iliad consensus client.
// newRunCmd returns a new cobra command that runs the story consensus client.
func newRunCmd(name string, runFunc func(context.Context, app.Config) error) *cobra.Command {
iliadCfg := iliadcfg.DefaultConfig()
storyCfg := storycfg.DefaultConfig()
logCfg := log.DefaultConfig()

cmd := &cobra.Command{
Use: name,
Short: "Runs the iliad consensus client",
Short: "Runs the story consensus client",
RunE: func(cmd *cobra.Command, _ []string) error {
ctx, err := log.Init(cmd.Context(), logCfg)
if err != nil {
Expand All @@ -42,19 +42,19 @@ func newRunCmd(name string, runFunc func(context.Context, app.Config) error) *co
return err
}

cometCfg, err := parseCometConfig(ctx, iliadCfg.HomeDir)
cometCfg, err := parseCometConfig(ctx, storyCfg.HomeDir)
if err != nil {
return err
}

return runFunc(ctx, app.Config{
Config: iliadCfg,
Config: storyCfg,
Comet: cometCfg,
})
},
}

bindRunFlags(cmd, &iliadCfg)
bindRunFlags(cmd, &storyCfg)
log.BindFlags(cmd.Flags(), &logCfg)

return cmd
Expand Down
6 changes: 3 additions & 3 deletions client/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"

iliadcfg "github.com/piplabs/story/client/config"
storycfg "github.com/piplabs/story/client/config"
libcmd "github.com/piplabs/story/lib/cmd"
"github.com/piplabs/story/lib/netconf"
"github.com/piplabs/story/lib/tracer"
)

func bindRunFlags(cmd *cobra.Command, cfg *iliadcfg.Config) {
func bindRunFlags(cmd *cobra.Command, cfg *storycfg.Config) {
flags := cmd.Flags()

libcmd.BindHomeFlag(flags, &cfg.HomeDir)
Expand All @@ -33,7 +33,7 @@ func bindRunFlags(cmd *cobra.Command, cfg *iliadcfg.Config) {
func bindInitFlags(flags *pflag.FlagSet, cfg *InitConfig) {
libcmd.BindHomeFlag(flags, &cfg.HomeDir)
netconf.BindFlag(flags, &cfg.Network)
flags.BoolVar(&cfg.TrustedSync, "trusted-sync", cfg.TrustedSync, "Initialize trusted state-sync height and hash by querying the Iliad RPC")
flags.BoolVar(&cfg.TrustedSync, "trusted-sync", cfg.TrustedSync, "Initialize trusted state-sync height and hash by querying the Story RPC")
flags.BoolVar(&cfg.Force, "force", cfg.Force, "Force initialization (overwrite existing files)")
flags.BoolVar(&cfg.Clean, "clean", cfg.Clean, "Delete home directory before initialization")
}
40 changes: 20 additions & 20 deletions client/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"

iliadcfg "github.com/piplabs/story/client/config"
storycfg "github.com/piplabs/story/client/config"
libcmd "github.com/piplabs/story/lib/cmd"
"github.com/piplabs/story/lib/errors"
"github.com/piplabs/story/lib/log"
Expand All @@ -35,25 +35,25 @@ type InitConfig struct {
ExecutionHash common.Hash
}

// newInitCmd returns a new cobra command that initializes the files and folders required by iliad.
// newInitCmd returns a new cobra command that initializes the files and folders required by story.
func newInitCmd() *cobra.Command {
// Default config flags
cfg := InitConfig{
HomeDir: iliadcfg.DefaultHomeDir(),
HomeDir: storycfg.DefaultHomeDir(),
Force: false,
}

cmd := &cobra.Command{
Use: "init",
Short: "Initializes required iliad files and directories",
Long: `Initializes required iliad files and directories.
Short: "Initializes required story files and directories",
Long: `Initializes required story files and directories.
Ensures all the following files and directories exist:
<home>/ # Iliad home directory
<home>/ # Story home directory
├── config # Config directory
│ ├── config.toml # CometBFT configuration
│ ├── genesis.json # Iliad chain genesis file
│ ├── iliad.toml # Iliad configuration
│ ├── genesis.json # Story chain genesis file
│ ├── story.toml # Story configuration
│ ├── node_key.json # Node P2P identity key
│ └── priv_validator_key.json # CometBFT private validator key (back this up and keep it safe)
├── data # Data directory
Expand All @@ -78,7 +78,7 @@ The home directory should only contain subdirectories, no files, use --force to
return cmd
}

// InitFiles initializes the files and folders required by iliad.
// InitFiles initializes the files and folders required by story.
// It ensures a network and genesis file is generated/downloaded for the provided network.
//
//nolint:gocognit,nestif // This is just many sequential steps.
Expand All @@ -87,7 +87,7 @@ func InitFiles(ctx context.Context, initCfg InitConfig) error {
return errors.New("required flag --network empty")
}

log.Info(ctx, "Initializing iliad files and directories")
log.Info(ctx, "Initializing story files and directories")
homeDir := initCfg.HomeDir
network := initCfg.Network

Expand All @@ -98,15 +98,15 @@ func InitFiles(ctx context.Context, initCfg InitConfig) error {
// Initialize default configs.
comet := DefaultCometConfig(homeDir)

var cfg iliadcfg.Config
var cfg storycfg.Config

switch {
case network == netconf.Iliad:
cfg = iliadcfg.IliadConfig
cfg = storycfg.IliadConfig
case network == netconf.Local:
cfg = iliadcfg.LocalConfig
cfg = storycfg.LocalConfig
default:
cfg = iliadcfg.DefaultConfig()
cfg = storycfg.DefaultConfig()
cfg.HomeDir = homeDir
cfg.Network = network
}
Expand Down Expand Up @@ -147,14 +147,14 @@ func InitFiles(ctx context.Context, initCfg InitConfig) error {
log.Info(ctx, "Generated default comet config file", "path", cmtConfigFile)
}

// Setup iliad config
iliadConfigFile := cfg.ConfigFile()
if cmtos.FileExists(iliadConfigFile) {
log.Info(ctx, "Found iliad config file", "path", iliadConfigFile)
} else if err := iliadcfg.WriteConfigTOML(cfg, log.DefaultConfig()); err != nil {
// Setup story config
storyConfigFile := cfg.ConfigFile()
if cmtos.FileExists(storyConfigFile) {
log.Info(ctx, "Found story config file", "path", storyConfigFile)
} else if err := storycfg.WriteConfigTOML(cfg, log.DefaultConfig()); err != nil {
return err
} else {
log.Info(ctx, "Generated default iliad config file", "path", iliadConfigFile)
log.Info(ctx, "Generated default story config file", "path", storyConfigFile)
}

// Setup comet private validator
Expand Down
12 changes: 6 additions & 6 deletions client/cmd/testdata/TestCLIReference_iliad.golden
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Iliad is a consensus client implementation for the Story L1 blockchain
Story is a consensus client implementation for the Story L1 blockchain

Usage:
iliad [command]
story [command]

Available Commands:
completion Generate the autocompletion script for the specified shell
help Help about any command
init Initializes required iliad files and directories
run Runs the iliad consensus client
init Initializes required story files and directories
run Runs the story consensus client
validator Commands for validator operations
version Print the version information of this binary

Flags:
-h, --help help for iliad
-h, --help help for story

Use "iliad [command] --help" for more information about a command.
Use "story [command] --help" for more information about a command.
16 changes: 8 additions & 8 deletions client/cmd/testdata/TestCLIReference_init.golden
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Initializes required iliad files and directories.
Initializes required story files and directories.

Ensures all the following files and directories exist:
<home>/ # Iliad home directory
<home>/ # Story home directory
├── config # Config directory
│ ├── config.toml # CometBFT configuration
│ ├── genesis.json # Iliad chain genesis file
│ ├── iliad.toml # Iliad configuration
│ ├── genesis.json # Story chain genesis file
│ ├── story.toml # Story configuration
│ ├── node_key.json # Node P2P identity key
│ └── priv_validator_key.json # CometBFT private validator key (back this up and keep it safe)
├── data # Data directory
Expand All @@ -16,12 +16,12 @@ Existing files are not overwritten, unless --clean is specified.
The home directory should only contain subdirectories, no files, use --force to ignore this check.

Usage:
iliad init [flags]
story init [flags]

Flags:
--clean Delete home directory before initialization
--force Force initialization (overwrite existing files)
-h, --help help for init
--home string The application home directory containing config and data (default "./iliad")
--network string Iliad network to participate in: mainnet, testnet, devnet
--trusted-sync Initialize trusted state-sync height and hash by querying the Iliad RPC
--home string The application home directory containing config and data (default "./story")
--network string Story network to participate in: mainnet, testnet, devnet
--trusted-sync Initialize trusted state-sync height and hash by querying the Story RPC
Loading

0 comments on commit dd39b7c

Please sign in to comment.