Skip to content

Commit

Permalink
Merge pull request lavanet#1130 from lavanet/CNS-run-second-validator
Browse files Browse the repository at this point in the history
CNS-run-second-validator
  • Loading branch information
Yaroms authored Jan 14, 2024
2 parents 9348684 + 794263c commit 575ffc2
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 15 deletions.
62 changes: 53 additions & 9 deletions scripts/add_validator.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,21 +1,65 @@
# this script is adding another validator to the chain (without a running node) (this validator will be soon jailed due to inactivity)
clear
rm -rf ~/.lava_test
lavad init validator2 --chain-id lava --home ~/.lava_test
lavad config broadcast-mode sync --home ~/.lava_test
lavad config keyring-backend test --home ~/.lava_test
lavad keys add validator2 --home ~/.lava_test
home=~/.lava2
rm -rf $home
lavad init validator2 --chain-id lava --home $home
lavad config broadcast-mode sync --home $home
lavad config keyring-backend test --home $home
lavad keys add validator2 --home $home

cp ~/.lava/config/addrbook.json $home/config/addrbook.json
cp ~/.lava/config/app.toml $home/config/app.toml
cp ~/.lava/config/client.toml $home/config/client.toml
cp ~/.lava/config/genesis.json $home/config/genesis.json


# Specify the file path, field to edit, and new value
path="$home/config/"
config='config.toml'
app='app.toml'

# Determine OS
os_name=$(uname)
case "$(uname)" in
Darwin)
SED_INLINE="-i ''" ;;
Linux)
SED_INLINE="-i" ;;
*)
echo "unknown system: $(uname)"
exit 1 ;;
esac

sed $SED_INLINE \
-e 's/tcp:\/\/0\.0\.0\.0:26656/tcp:\/\/0.0.0.0:36656/' \
-e 's/tcp:\/\/127\.0\.0\.1:26658/tcp:\/\/127.0.0.1:36658/' \
-e 's/tcp:\/\/127\.0\.0\.1:26657/tcp:\/\/127.0.0.1:36657/' \
-e 's/tcp:\/\/127\.0\.0\.1:26656/tcp:\/\/127.0.0.1:36656/' "$path$config"

# Edit app.toml file
sed $SED_INLINE \
-e 's/tcp:\/\/localhost:1317/tcp:\/\/localhost:2317/' \
-e 's/localhost:9090/localhost:8090/' \
-e 's/":7070"/":7070"/' \
-e 's/localhost:9091/localhost:8091/' "$path$app"


GASPRICE="0.000000001ulava"
lavad tx bank send $(lavad keys show alice -a) $(lavad keys show validator2 -a --home ~/.lava_test) 500000ulava -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
lavad tx bank send $(lavad keys show alice -a) $(lavad keys show validator2 -a --home $home) 10000000000001ulava -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
sleep 3

lavad tx staking create-validator -y --from validator2 --amount="50000ulava" --pubkey=$(lavad tendermint show-validator --home ~/.lava_test) --commission-rate="0.10" \
lavad tx staking create-validator -y --from validator2 --amount="10000000000000ulava" --pubkey=$(lavad tendermint show-validator --home $home) \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1000" \
--gas-adjustment "1.5" \
--gas "auto" \
--gas-prices $GASPRICE \
--home ~/.lava_test
--home $home

id=$(lavad status | jq .NodeInfo.id -r)
addr=$(lavad status | jq .NodeInfo.listen_addr -r | sed 's/tcp:\/\///')
lavad start --home $home --p2p.seeds $id@$addr


lavad tx staking redelegate lava@valoper1yhzkfrcdwf2hwpc4cre8er5tamp6wdm4stx2ec lava@valoper1z025w20ms6cpdht585nhsw682jph4yc7hx0gqc 500000000000ulava -y --from user1 --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
2 changes: 2 additions & 0 deletions scripts/init_chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ sed $SED_INLINE \

# Edit app.toml file
sed $SED_INLINE -e "s/enable = .*/enable = true/" "$path$app"
sed $SED_INLINE -e "/Enable defines if the Rosetta API server should be enabled.*/{n;s/enable = .*/enable = false/}" "$path$app"


# Add users
users=("alice" "bob" "user1" "user2" "user3" "user4" "user5" "servicer1" "servicer2" "servicer3" "servicer4" "servicer5" "servicer6" "servicer7" "servicer8" "servicer9" "servicer10")
Expand Down
4 changes: 3 additions & 1 deletion x/fixationstore/types/fixationstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,9 @@ func (fs *FixationStore) Export(ctx sdk.Context) GenesisState {

func DefaultGenesis() *GenesisState {
return &GenesisState{
Version: FixationVersion(),
Version: FixationVersion(),
Timerstore: *timerstoretypes.DefaultGenesis(),
Entries: []GenesisEntries{},
}
}

Expand Down
5 changes: 5 additions & 0 deletions x/pairing/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package types

import (
"fmt"

fixationtypes "github.com/lavanet/lava/x/fixationstore/types"
timerstoretypes "github.com/lavanet/lava/x/timerstore/types"
)

// DefaultIndex is the default capability global index
Expand All @@ -14,6 +17,8 @@ func DefaultGenesis() *GenesisState {
ProviderPaymentStorageList: []ProviderPaymentStorage{},
EpochPaymentsList: []EpochPayments{},
BadgeUsedCuList: []BadgeUsedCu{},
BadgesTS: *timerstoretypes.DefaultGenesis(),
ProviderQosFS: *fixationtypes.DefaultGenesis(),
// this line is used by starport scaffolding # genesis/types/default
Params: DefaultParams(),
}
Expand Down
10 changes: 8 additions & 2 deletions x/rewards/types/genesis.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package types

import fmt "fmt"
import (
fmt "fmt"

"github.com/lavanet/lava/x/timerstore/types"
)

// this line is used by starport scaffolding # genesis/types/import

Expand All @@ -11,7 +15,9 @@ const DefaultIndex uint64 = 1
func DefaultGenesis() *GenesisState {
return &GenesisState{
// this line is used by starport scaffolding # genesis/types/default
Params: DefaultParams(),
Params: DefaultParams(),
RefillRewardsTS: *types.DefaultGenesis(),
BasePays: []BasePayGenesis{},
}
}

Expand Down
3 changes: 2 additions & 1 deletion x/spec/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const DefaultIndex uint64 = 1
// DefaultGenesis returns the default Capability genesis state
func DefaultGenesis() *GenesisState {
return &GenesisState{
SpecList: []Spec{},
SpecList: []Spec{},
SpecCount: 0,
// this line is used by starport scaffolding # genesis/types/default
Params: DefaultParams(),
}
Expand Down
9 changes: 7 additions & 2 deletions x/subscription/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types

import (
fixationstoretypes "github.com/lavanet/lava/x/fixationstore/types"
timerstoretypes "github.com/lavanet/lava/x/timerstore/types"
)

// this line is used by starport scaffolding # genesis/types/import
Expand All @@ -13,8 +14,12 @@ const DefaultIndex uint64 = 1
func DefaultGenesis() *GenesisState {
return &GenesisState{
// this line is used by starport scaffolding # genesis/types/default
Params: DefaultParams(),
SubsFS: *fixationstoretypes.DefaultGenesis(),
Params: DefaultParams(),
SubsFS: *fixationstoretypes.DefaultGenesis(),
SubsTS: *timerstoretypes.DefaultGenesis(),
CuTrackerFS: *fixationstoretypes.DefaultGenesis(),
CuTrackerTS: *timerstoretypes.DefaultGenesis(),
Adjustments: []Adjustment{},
}
}

Expand Down

0 comments on commit 575ffc2

Please sign in to comment.