Skip to content

Commit

Permalink
update types in application launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
uprendis committed Sep 9, 2020
1 parent 231e90b commit 6bce546
Show file tree
Hide file tree
Showing 52 changed files with 203 additions and 172 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ glide.lock
*.tgz
*.zip

# lachesis project specific
# opera project specific
scripts/certs
scripts/nodes
scripts/peers.json
Expand Down
8 changes: 4 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ before:
hooks:
- make clean proto vendor
builds:
- main: ./cmd/lachesis/main.go
binary: go-lachesis
- main: ./cmd/opera/main.go
binary: go-opera
ldflags:
- -linkmode external -extldflags -static -s -w
- -X main.gitCommit={{ .ShortCommit }}
Expand Down Expand Up @@ -49,10 +49,10 @@ nfpm:
- rpm

empty_folders:
- /var/log/go-lachesis
- /var/log/go-opera

files:
"scripts/daemon/go-lachesis.service": "/lib/systemd/system/go-lachesis.service"
"scripts/daemon/go-opera.service": "/lib/systemd/system/go-opera.service"

# scripts:
# preinstall: "scripts/preinstall.bash"
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: go
go:
- 1.13.x

go_import_path: github.com/Fantom-foundation/go-lachesis
go_import_path: github.com/Fantom-foundation/go-opera

cache:
directories:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# build
.PHONY : build txstorm
build :
go build -o build/lachesis ./cmd/lachesis
go build -o build/opera ./cmd/opera

txstorm :
go build -o build/tx-storm ./cmd/tx-storm
Expand All @@ -13,4 +13,4 @@ test :
#clean
.PHONY : clean
clean :
rm ./build/lachesis ./build/tx-storm
rm ./build/opera
4 changes: 2 additions & 2 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Please check if what you want to add to `go-lachesis` list meets [quality standards](https://github.com/Fantom-foundation/go-lachesis/blob/master/CONTRIBUTING.md#quality-standard) before sending pull request.
Please check if what you want to add to `go-opera` list meets [quality standards](https://github.com/Fantom-foundation/go-opera/blob/master/CONTRIBUTING.md#quality-standard) before sending pull request.

**Please provide package links to:**

Expand All @@ -14,4 +14,4 @@ Please check if what you want to add to `go-lachesis` list meets [quality standa
- [ ] I have added godoc link to the repo and to my pull request.
- [ ] I have added coverage service link to the repo and to my pull request.
- [ ] I have added goreportcard link to the repo and to my pull request.
- [ ] I have read [Contribution guidelines](https://github.com/Fantom-foundation/go-lachesis/blob/master/CONTRIBUTING.md#contribution-guidelines), [maintainers note](https://github.com/Fantom-foundation/go-lachesis/blob/master/CONTRIBUTING.md#maintainers) and [Quality standard](https://github.com/Fantom-foundation/go-lachesis/blob/master/CONTRIBUTING.md#quality-standard).
- [ ] I have read [Contribution guidelines](https://github.com/Fantom-foundation/go-opera/blob/master/CONTRIBUTING.md#contribution-guidelines), [maintainers note](https://github.com/Fantom-foundation/go-opera/blob/master/CONTRIBUTING.md#maintainers) and [Quality standard](https://github.com/Fantom-foundation/go-opera/blob/master/CONTRIBUTING.md#quality-standard).
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ image: Visual Studio 2017

build: off

clone_folder: c:\gopath\src\github.com\Fantom-foundation\go-lachesis
clone_folder: c:\gopath\src\github.com\Fantom-foundation\go-opera

environment:
PATH: C:\gopath\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin;C:\PROGRA~1\Git\bin;C:\PROGRA~1\Git\usr\bin\;C:\ProgramData\chocolatey\bin;$(PATH)
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmdtest/test_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type TestCmd struct {
}

// Run exec's the current binary using name as argv[0] which will trigger the
// reexec init function for that name (e.g. "lachesis-test" in cmd/run_test.go)
// reexec init function for that name (e.g. "opera-test" in cmd/run_test.go)
func (tt *TestCmd) Run(name string, args ...string) {
tt.stderr = &testlogger{t: tt.T}
tt.cmd = &exec.Cmd{
Expand Down
14 changes: 7 additions & 7 deletions cmd/lachesis/accountcmd.go → cmd/opera/accountcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (
ArgsUsage: "",
Category: "ACCOUNT COMMANDS",
Description: `
lachesis wallet import /path/to/my/presale.wallet
opera wallet import /path/to/my/presale.wallet
will prompt for your password and imports your ether presale account.
It can be used non-interactively with the --password option taking a
Expand All @@ -56,7 +56,7 @@ passwordfile as argument containing the wallet password in plaintext.`,
utils.LightKDFFlag,
},
Description: `
lachesis wallet [options] /path/to/my/presale.wallet
opera wallet [options] /path/to/my/presale.wallet
will prompt for your password and imports your ether presale account.
It can be used non-interactively with the --password option taking a
Expand Down Expand Up @@ -112,7 +112,7 @@ Print a short summary of all accounts`,
utils.LightKDFFlag,
},
Description: `
lachesis account new
opera account new
Creates a new account and prints the address.
Expand All @@ -137,7 +137,7 @@ password to file or expose in any other way.
utils.LightKDFFlag,
},
Description: `
lachesis account update <address>
opera account update <address>
Update an existing account.
Expand All @@ -149,7 +149,7 @@ format to the newest format or change the password for an account.
For non-interactive use the passphrase can be specified with the --password flag:
lachesis account update [options] <address>
opera account update [options] <address>
Since only one password can be given, only format update can be performed,
changing your password is only possible interactively.
Expand All @@ -167,7 +167,7 @@ changing your password is only possible interactively.
},
ArgsUsage: "<keyFile>",
Description: `
lachesis account import <keyfile>
opera account import <keyfile>
Imports an unencrypted private key from <keyfile> and creates a new account.
Prints the address.
Expand All @@ -180,7 +180,7 @@ You must remember this passphrase to unlock your account in the future.
For non-interactive use the passphrase can be specified with the -password flag:
lachesis account import [options] <keyfile>
opera account import [options] <keyfile>
Note:
As you can directly copy your encrypted accounts to another ethereum instance,
Expand Down
File renamed without changes.
File renamed without changes.
24 changes: 12 additions & 12 deletions cmd/lachesis/config.go → cmd/opera/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
"github.com/naoina/toml"
"gopkg.in/urfave/cli.v1"

"github.com/Fantom-foundation/go-lachesis/evmcore"
"github.com/Fantom-foundation/go-lachesis/gossip"
"github.com/Fantom-foundation/go-lachesis/gossip/gasprice"
"github.com/Fantom-foundation/go-lachesis/lachesis"
"github.com/Fantom-foundation/go-opera/evmcore"
"github.com/Fantom-foundation/go-opera/gossip"
"github.com/Fantom-foundation/go-opera/gossip/gasprice"
"github.com/Fantom-foundation/go-opera/opera"
)

var (
Expand Down Expand Up @@ -93,20 +93,20 @@ func loadAllConfigs(file string, cfg *config) error {
return err
}

func defaultLachesisConfig(ctx *cli.Context) lachesis.Config {
var cfg lachesis.Config
func defaultLachesisConfig(ctx *cli.Context) opera.Config {
var cfg opera.Config

switch {
case ctx.GlobalIsSet(FakeNetFlag.Name):
_, accs, err := parseFakeGen(ctx.GlobalString(FakeNetFlag.Name))
if err != nil {
log.Crit("Invalid flag", "flag", FakeNetFlag.Name, "err", err)
}
cfg = lachesis.FakeNetConfig(accs)
cfg = opera.FakeNetConfig(accs)
case ctx.GlobalBool(utils.TestnetFlag.Name):
cfg = lachesis.TestNetConfig()
cfg = opera.TestNetConfig()
default:
cfg = lachesis.MainNetConfig()
cfg = opera.MainNetConfig()
}

return cfg
Expand Down Expand Up @@ -257,9 +257,9 @@ func defaultNodeConfig() node.Config {
cfg := NodeDefaultConfig
cfg.Name = clientIdentifier
cfg.Version = params.VersionWithCommit(gitCommit, gitDate)
cfg.HTTPModules = append(cfg.HTTPModules, "eth", "ftm", "sfc", "web3")
cfg.WSModules = append(cfg.WSModules, "eth", "ftm", "sfc", "web3")
cfg.IPCPath = "lachesis.ipc"
cfg.HTTPModules = append(cfg.HTTPModules, "eth", "ftm", "dag", "web3")
cfg.WSModules = append(cfg.WSModules, "eth", "ftm", "dag", "web3")
cfg.IPCPath = "opera.ipc"
cfg.DataDir = DefaultDataDir()
return cfg
}
Expand Down
24 changes: 12 additions & 12 deletions cmd/lachesis/consolecmd.go → cmd/opera/consolecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
Flags: append(append(append(nodeFlags, rpcFlags...), consoleFlags...), testFlags...),
Category: "CONSOLE COMMANDS",
Description: `
The lachesis console is an interactive shell for the JavaScript runtime environment
The opera console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API.
See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.`,
}
Expand All @@ -54,10 +54,10 @@ See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.`,
Flags: append(consoleFlags, utils.DataDirFlag),
Category: "CONSOLE COMMANDS",
Description: `
The lachesis console is an interactive shell for the JavaScript runtime environment
The opera console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API.
See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.
This command allows to open a console on a running lachesis node.`,
This command allows to open a console on a running opera node.`,
}

javascriptCommand = cli.Command{
Expand All @@ -73,7 +73,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Cons
}
)

// localConsole starts a new lachesis node, attaching a JavaScript console to it at the
// localConsole starts a new opera node, attaching a JavaScript console to it at the
// same time.
func localConsole(ctx *cli.Context) error {
// Create and start the node based on the CLI flags
Expand All @@ -84,7 +84,7 @@ func localConsole(ctx *cli.Context) error {
// Attach to the newly started node and start the JavaScript console
client, err := node.Attach()
if err != nil {
utils.Fatalf("Failed to attach to the inproc lachesis: %v", err)
utils.Fatalf("Failed to attach to the inproc opera: %v", err)
}
config := console.Config{
DataDir: utils.MakeDataDir(ctx),
Expand All @@ -111,10 +111,10 @@ func localConsole(ctx *cli.Context) error {
return nil
}

// remoteConsole will connect to a remote lachesis instance, attaching a JavaScript
// remoteConsole will connect to a remote opera instance, attaching a JavaScript
// console to it.
func remoteConsole(ctx *cli.Context) error {
// Attach to a remotely running lachesis instance and start the JavaScript console
// Attach to a remotely running opera instance and start the JavaScript console
endpoint := ctx.Args().First()
if endpoint == "" {
path := DefaultDataDir()
Expand All @@ -128,11 +128,11 @@ func remoteConsole(ctx *cli.Context) error {
path = filepath.Join(path, "rinkeby")
}
}
endpoint = fmt.Sprintf("%s/lachesis.ipc", path)
endpoint = fmt.Sprintf("%s/opera.ipc", path)
}
client, err := dialRPC(endpoint)
if err != nil {
utils.Fatalf("Unable to attach to remote lachesis: %v", err)
utils.Fatalf("Unable to attach to remote opera: %v", err)
}
config := console.Config{
DataDir: utils.MakeDataDir(ctx),
Expand Down Expand Up @@ -161,7 +161,7 @@ func remoteConsole(ctx *cli.Context) error {

// dialRPC returns a RPC client which connects to the given endpoint.
// The check for empty endpoint implements the defaulting logic
// for "lachesis attach" and "lachesis monitor" with no argument.
// for "opera attach" and "opera monitor" with no argument.
func dialRPC(endpoint string) (*rpc.Client, error) {
if endpoint == "" {
endpoint = node.DefaultIPCEndpoint(clientIdentifier)
Expand All @@ -172,7 +172,7 @@ func dialRPC(endpoint string) (*rpc.Client, error) {
return rpc.Dial(endpoint)
}

// ephemeralConsole starts a new lachesis node, attaches an ephemeral JavaScript
// ephemeralConsole starts a new opera node, attaches an ephemeral JavaScript
// console to it, executes each of the files specified as arguments and tears
// everything down.
func ephemeralConsole(ctx *cli.Context) error {
Expand All @@ -184,7 +184,7 @@ func ephemeralConsole(ctx *cli.Context) error {
// Attach to the newly started node and start the JavaScript console
client, err := node.Attach()
if err != nil {
utils.Fatalf("Failed to attach to the inproc lachesis: %v", err)
utils.Fatalf("Failed to attach to the inproc opera: %v", err)
}
config := console.Config{
DataDir: utils.MakeDataDir(ctx),
Expand Down
16 changes: 8 additions & 8 deletions cmd/lachesis/consolecmd_test.go → cmd/opera/consolecmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ import (

"github.com/ethereum/go-ethereum/params"

"github.com/Fantom-foundation/go-lachesis/lachesis/genesis"
"github.com/Fantom-foundation/go-opera/opera/genesis"
)

const (
ipcAPIs = "admin:1.0 debug:1.0 ftm:1.0 net:1.0 personal:1.0 rpc:1.0 sfc:1.0 txpool:1.0 web3:1.0"
httpAPIs = "ftm:1.0 rpc:1.0 sfc:1.0 web3:1.0"
ipcAPIs = "admin:1.0 dag:1.0 debug:1.0 ftm:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0"
httpAPIs = "dag:1.0 ftm:1.0 rpc:1.0 web3:1.0"
)

// Tests that a node embedded within a console can be started up properly and
// then terminated by closing the input stream.
func TestConsoleWelcome(t *testing.T) {
// Start a lachesis console, make sure it's cleaned up and terminate the console
// Start a opera console, make sure it's cleaned up and terminate the console
cli := exec(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"console")
Expand All @@ -41,7 +41,7 @@ func TestConsoleWelcome(t *testing.T) {
cli.Expect(`
Welcome to the Lachesis JavaScript console!
instance: go-lachesis/v{{version}}/{{goos}}-{{goarch}}/{{gover}}
instance: go-opera/v{{version}}/{{goos}}-{{goarch}}/{{gover}}
coinbase: {{.Coinbase}}
at block: 0 ({{niltime}})
datadir: {{.Datadir}}
Expand All @@ -61,7 +61,7 @@ func TestIPCAttachWelcome(t *testing.T) {
} else {
ws := tmpdir(t)
defer os.RemoveAll(ws)
ipc = filepath.Join(ws, "lachesis.ipc")
ipc = filepath.Join(ws, "opera.ipc")
}
cli := exec(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestWSAttachWelcome(t *testing.T) {
}

func testAttachWelcome(t *testing.T, cli *testcli, endpoint, apis string) {
// Attach to a running lachesis node and terminate immediately
// Attach to a running opera node and terminate immediately
attach := exec(t, "attach", endpoint)

// Gather all the infos the welcome message needs to contain
Expand All @@ -122,7 +122,7 @@ func testAttachWelcome(t *testing.T, cli *testcli, endpoint, apis string) {
attach.Expect(`
Welcome to the Lachesis JavaScript console!
instance: go-lachesis/v{{version}}/{{goos}}-{{goarch}}/{{gover}}
instance: go-opera/v{{version}}/{{goos}}-{{goarch}}/{{gover}}
coinbase: {{coinbase}}
at block: 0 ({{niltime}}){{if ipc}}
datadir: {{datadir}}{{end}}
Expand Down
2 changes: 1 addition & 1 deletion cmd/lachesis/defaults.go → cmd/opera/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func DefaultDataDir() string {
}
return filepath.Join(appdata, "Lachesis")
default:
return filepath.Join(home, ".lachesis")
return filepath.Join(home, ".opera")
}
}
// As we cannot guess a stable location, return empty and handle later
Expand Down
6 changes: 3 additions & 3 deletions cmd/lachesis/emitter.go → cmd/opera/emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
cli "gopkg.in/urfave/cli.v1"

"github.com/Fantom-foundation/go-lachesis/crypto"
"github.com/Fantom-foundation/go-lachesis/gossip"
"github.com/Fantom-foundation/go-opera/crypto"
"github.com/Fantom-foundation/go-opera/gossip/emitter"
)

var validatorFlag = cli.StringFlag{
Expand All @@ -17,7 +17,7 @@ var validatorFlag = cli.StringFlag{

// setValidator retrieves the validator address either from the directly specified
// command line flags or from the keystore if CLI indexed.
func setValidator(ctx *cli.Context, ks *keystore.KeyStore, cfg *gossip.EmitterConfig) {
func setValidator(ctx *cli.Context, ks *keystore.KeyStore, cfg *emitter.Config) {
// Extract the current validator address, new flag overriding legacy one
var validator string
switch {
Expand Down
Loading

0 comments on commit 6bce546

Please sign in to comment.