-
Notifications
You must be signed in to change notification settings - Fork 10
Update chain id arguments handling #129
base: master
Are you sure you want to change the base?
Changes from 6 commits
62329e5
23b886b
2c5a32f
9512ebb
63dd8d8
71258dc
8d380f3
b8fe97d
375d600
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/target/ | ||
**/*.rs.bk | ||
*.rs.bk | ||
.idea/ | ||
*.iml | ||
Cargo.lock | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,14 +37,14 @@ teardown() { | |
[[ "$output" == *"SUBCOMMANDS"* ]] | ||
} | ||
|
||
@test "succeeds: --chain=morden account new [empty options]" { | ||
run $EMERALD_VAULT --chain=morden account new <<< $'foo\n' | ||
@test "succeeds: --chain=etc-test account new [empty options]" { | ||
splix marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run $EMERALD_CLI --chain=etc-test account new <<< $'foo\n' | ||
[ "$status" -eq 0 ] | ||
[[ "$output" == *"Created new account"* ]] | ||
} | ||
|
||
@test "succeeds: --chain=mainnet new --security=high --name='Test account' --description='Some description'" { | ||
run $EMERALD_VAULT --chain=mainnet \ | ||
@test "succeeds: --chain=etc-main new --security=high --name='Test account' --description='Some description'" { | ||
run $EMERALD_CLI --chain=etc-main \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because ETH and ETC can't share same name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above |
||
account new \ | ||
--security-level=high \ | ||
--name="Test account" \ | ||
|
@@ -55,7 +55,7 @@ teardown() { | |
} | ||
|
||
@test "succeeds: account list" { | ||
run $EMERALD_VAULT --chain=morden \ | ||
run $EMERALD_CLI --chain=etc-test \ | ||
account new \ | ||
<<< $'foo\n' | ||
[ "$status" -eq 0 ] | ||
|
@@ -69,7 +69,7 @@ teardown() { | |
[[ "$address" != "" ]] | ||
[[ "$address" == *"0x"* ]] | ||
|
||
run $EMERALD_VAULT --chain=morden account list | ||
run $EMERALD_CLI --chain=etc-test account list | ||
echo "$output" # prints in case fails | ||
echo "$address" | ||
|
||
|
@@ -78,7 +78,7 @@ teardown() { | |
} | ||
|
||
@test "succeeds: account update" { | ||
run $EMERALD_VAULT --chain=morden account new \ | ||
run $EMERALD_CLI --chain=etc-test account new \ | ||
<<< $'foo\n' | ||
[ "$status" -eq 0 ] | ||
[[ "$output" == *"Created new account"* ]] | ||
|
@@ -91,20 +91,20 @@ teardown() { | |
[[ "$address" != "" ]] | ||
[[ "$address" == *"0x"* ]] | ||
|
||
run $EMERALD_VAULT --chain=morden account update \ | ||
run $EMERALD_CLI --chain=etc-test account update \ | ||
"$address" \ | ||
--name="new name" \ | ||
--description="new description" | ||
[ "$status" -eq 0 ] | ||
|
||
run $EMERALD_VAULT --chain=morden account list | ||
run $EMERALD_CLI --chain=etc-test account list | ||
|
||
[ "$status" -eq 0 ] | ||
[[ "$output" == *"new name"* ]] | ||
} | ||
|
||
@test "succeeds: account strip" { | ||
run $EMERALD_VAULT --chain=morden account new \ | ||
run $EMERALD_CLI --chain=etc-test account new \ | ||
<<< $'foo\n' | ||
[ "$status" -eq 0 ] | ||
[[ "$output" == *"Created new account"* ]] | ||
|
@@ -117,7 +117,7 @@ teardown() { | |
[[ "$address" != "" ]] | ||
[[ "$address" == *"0x"* ]] | ||
|
||
run $EMERALD_VAULT --chain=morden account strip \ | ||
run $EMERALD_CLI --chain=etc-test account strip \ | ||
"$address" \ | ||
<<< $'foo\n' | ||
|
||
|
@@ -126,7 +126,7 @@ teardown() { | |
} | ||
|
||
@test "succeeds: account hide && unhide" { | ||
run $EMERALD_VAULT --chain=morden account new \ | ||
run $EMERALD_CLI --chain=etc-test account new \ | ||
<<< $'foo\n' | ||
[ "$status" -eq 0 ] | ||
[[ "$output" == *"Created new account"* ]] | ||
|
@@ -140,22 +140,22 @@ teardown() { | |
[[ "$address" == *"0x"* ]] | ||
|
||
# Hide account. | ||
run $EMERALD_VAULT --chain=morden account hide \ | ||
run $EMERALD_CLI --chain=etc-test account hide \ | ||
"$address" | ||
[ "$status" -eq 0 ] | ||
|
||
# Ensure is hidden; doesn't show up in list. | ||
run $EMERALD_VAULT --chain=morden account list \ | ||
run $EMERALD_CLI --chain=etc-test account list \ | ||
|
||
[ "$status" -eq 0 ] | ||
[[ "$output" != *"$address"* ]] | ||
|
||
# Unhide account. | ||
run $EMERALD_VAULT --chain=morden account unhide \ | ||
run $EMERALD_CLI --chain=etc-test account unhide \ | ||
"$address" | ||
|
||
# Ensure is not hidden; shows up in list. | ||
run $EMERALD_VAULT --chain=morden account list | ||
run $EMERALD_CLI --chain=etc-test account list | ||
|
||
[ "$status" -eq 0 ] | ||
[[ "$output" == *"$address"* ]] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ FLAGS: | |
|
||
OPTIONS: | ||
-p, --base-path <base-path> Set path for chain storage | ||
-c, --chain <chain> Sets a chain name [default: mainnet] | ||
-c, --chain <chain> Sets a chain name [default: etc-main] | ||
|
||
SUBCOMMANDS: | ||
account Account related commands | ||
|
@@ -64,13 +64,25 @@ Environment variables allow you to redefine the default settings: | |
|
||
* `EMERALD_HOST` - RPC server listen host | ||
* `EMERALD_PORT` - RPC server listen port | ||
* `EMERALD_CHAIN` - chain name (`mainnet` | `morden`), has a higher priority relative to `EMERALD_CHAIN_ID` | ||
* `EMERALD_CHAIN` - chain name (see Table.1, `CLI argument` column), has a higher priority relative to `EMERALD_CHAIN_ID` | ||
* `EMERALD_CHAIN_ID` - chain id number, has a lower priority relative to `EMERALD_CHAIN` | ||
* `EMERALD_GAS` - maximum gas limit to use by transaction | ||
* `EMERALD_GAS_PRICE` - gas cost to use by transaction (in Gwei) | ||
* `EMERALD_SECURITY_LEVEL` - security level (`normal` | `high` | `ultra`) | ||
* `EMERALD_NODE` - url to upstream node. Used for sign and send of transactions | ||
|
||
| Chain id | Description | CLI argument | | ||
|-----------|-----------------------------------|----------------| | ||
| 1 | Ethereum mainnet | eth | | ||
| 2 | Morden (disused), Expanse mainnet | morden | | ||
| 3 | Ropsten | ropsten | | ||
| 4 | Rinkeby | rinkeby | | ||
| 30 | Rootstock mainnet | rootstock-main | | ||
| 31 | Rootstock testnet | rootstock-test | | ||
| 42 | Kovan | kovan | | ||
| 61 | Ethereum Classic mainnet | etc-main | | ||
| 62 | Ethereum Classic testnet | etc-test | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. geth uses morden, why vault has own testnet instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ETH morden chain id is 2, ETC morden - 62 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should (or is?) CLI argument like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and let's use |
||
Table 1. Chain id and name | ||
|
||
## Output details level | ||
|
||
|
@@ -82,4 +94,4 @@ Will set verbose level to 1 - only info messages. | |
|
||
# emerald-vault -vv | ||
|
||
Will set verbose level to 2 - info and debug messages. | ||
Will set verbose level to 2 - info and debug messages. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//! # Storage migration related commands | ||
|
||
use super::ExecResult; | ||
use std::path::Path; | ||
|
||
/// Migrate storage from old scheme to new | ||
/// | ||
/// # Arguments: | ||
/// | ||
/// * | ||
/// | ||
// /home/k2/.emerald | ||
// ├── [4.0K] mainnet | ||
// │ ├── [4.0K] addressbook | ||
// │ ├── [4.0K] contracts | ||
// │ │ ├── [1.8K] 0x0047201aed0b69875b24b614dda0270bcd9f11cc.json | ||
// │ │ └── [ 78] 0x085fb4f24031eaedbc2b611aa528f22343eb52db.json | ||
// │ └── [4.0K] keystore | ||
// ├── [4.0K] morden | ||
// │ ├── [4.0K] addressbook | ||
// │ ├── [4.0K] contracts | ||
// │ └── [4.0K] keystore | ||
// └── [4.0K] testnet | ||
// ├── [4.0K] contracts | ||
// └── [4.0K] keystore | ||
|
||
pub fn migrate_cmd() -> ExecResult { | ||
println!("{}", Path::new("/home/.emerald/mainnet").exists()); | ||
println!("{}", Path::new("/home/.emerald/morden").exists()); | ||
println!("{}", Path::new("/home/.emerald/testnet").exists()); | ||
|
||
Ok(()) | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because ETH and ETC can't share same name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but ETH is ETH, not mainnet, it's different name. I mean it's ok to have etc as a synonym to mainnet, but it shouldn't eliminate mainnet, because it's what expected to use for mainnet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I see. Will make then prefix for specific blockchain (
etc-..
|eth-...
) and leave as is for distinctive name.