Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
osmosis
Commits
55555998
Unverified
Commit
55555998
authored
2 years ago
by
Roman
Committed by
GitHub
2 years ago
Browse files
Options
Download
Email Patches
Plain Diff
e2e: backport #2125 - state-sync initialization (#2129)
parent
304db139
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
tests/e2e/initialization/init.go
+6
-2
tests/e2e/initialization/init.go
tests/e2e/initialization/init_test.go
+1
-1
tests/e2e/initialization/init_test.go
tests/e2e/initialization/node.go
+1
-2
tests/e2e/initialization/node.go
tests/e2e/initialization/node/main.go
+9
-1
tests/e2e/initialization/node/main.go
with
17 additions
and
6 deletions
+17
-6
tests/e2e/initialization/init.go
+
6
-
2
View file @
55555998
...
...
@@ -36,7 +36,7 @@ func InitChain(id, dataDir string, nodeConfigs []*NodeConfig, votingPeriod time.
for
_
,
node
:=
range
chain
.
nodes
{
if
node
.
isValidator
{
if
err
:=
node
.
init
Validator
Configs
(
chain
,
peers
);
err
!=
nil
{
if
err
:=
node
.
init
Node
Configs
(
peers
);
err
!=
nil
{
return
nil
,
err
}
}
...
...
@@ -44,7 +44,7 @@ func InitChain(id, dataDir string, nodeConfigs []*NodeConfig, votingPeriod time.
return
chain
.
export
(),
nil
}
func
InitSingleNode
(
chainId
,
dataDir
string
,
existingGenesisDir
string
,
nodeConfig
*
NodeConfig
,
votingPeriod
time
.
Duration
,
trustHeight
int64
,
trustHash
string
,
stateSyncRPCServers
[]
string
)
(
*
Node
,
error
)
{
func
InitSingleNode
(
chainId
,
dataDir
string
,
existingGenesisDir
string
,
nodeConfig
*
NodeConfig
,
votingPeriod
time
.
Duration
,
trustHeight
int64
,
trustHash
string
,
stateSyncRPCServers
[]
string
,
persistentPeers
[]
string
)
(
*
Node
,
error
)
{
if
nodeConfig
.
IsValidator
{
return
nil
,
errors
.
New
(
"creating individual validator nodes after starting up chain is not currently supported"
)
}
...
...
@@ -67,6 +67,10 @@ func InitSingleNode(chainId, dataDir string, existingGenesisDir string, nodeConf
return
nil
,
err
}
if
err
:=
newNode
.
initNodeConfigs
(
persistentPeers
);
err
!=
nil
{
return
nil
,
err
}
if
err
:=
newNode
.
initStateSyncConfig
(
trustHeight
,
trustHash
,
stateSyncRPCServers
);
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
tests/e2e/initialization/init_test.go
+
1
-
1
View file @
55555998
...
...
@@ -110,7 +110,7 @@ func TestSingleNodeInit(t *testing.T) {
existingChain
,
err
:=
initialization
.
InitChain
(
id
,
dataDir
,
existingChainNodeConfigs
,
time
.
Second
*
3
,
forkHeight
)
require
.
NoError
(
t
,
err
)
actualNode
,
err
:=
initialization
.
InitSingleNode
(
existingChain
.
ChainMeta
.
Id
,
dataDir
,
filepath
.
Join
(
existingChain
.
Nodes
[
0
]
.
ConfigDir
,
"config"
,
"genesis.json"
),
expectedConfig
,
time
.
Second
*
3
,
3
,
"testHash"
,
[]
string
{
"some server"
})
actualNode
,
err
:=
initialization
.
InitSingleNode
(
existingChain
.
ChainMeta
.
Id
,
dataDir
,
filepath
.
Join
(
existingChain
.
Nodes
[
0
]
.
ConfigDir
,
"config"
,
"genesis.json"
),
expectedConfig
,
time
.
Second
*
3
,
3
,
"testHash"
,
[]
string
{
"some
server"
},
[]
string
{
"some
server"
})
require
.
NoError
(
t
,
err
)
validateNode
(
t
,
id
,
dataDir
,
expectedConfig
,
actualNode
)
...
...
This diff is collapsed.
Click to expand it.
tests/e2e/initialization/node.go
+
1
-
2
View file @
55555998
...
...
@@ -290,7 +290,7 @@ func (n *internalNode) createMnemonic() (string, error) {
return
mnemonic
,
nil
}
func
(
n
*
internalNode
)
init
ValidatorConfigs
(
c
*
internalChain
,
persistentPeers
[]
string
)
error
{
func
(
n
*
internalNode
)
init
NodeConfigs
(
persistentPeers
[]
string
)
error
{
tmCfgPath
:=
filepath
.
Join
(
n
.
configDir
(),
"config"
,
"config.toml"
)
vpr
:=
viper
.
New
()
...
...
@@ -311,7 +311,6 @@ func (n *internalNode) initValidatorConfigs(c *internalChain, persistentPeers []
valConfig
.
StateSync
.
Enable
=
false
valConfig
.
LogLevel
=
"info"
valConfig
.
P2P
.
PersistentPeers
=
strings
.
Join
(
persistentPeers
,
","
)
valConfig
.
Consensus
=
tmconfig
.
TestConsensusConfig
()
tmconfig
.
WriteConfigFile
(
tmCfgPath
,
valConfig
)
return
nil
...
...
This diff is collapsed.
Click to expand it.
tests/e2e/initialization/node/main.go
+
9
-
1
View file @
55555998
...
...
@@ -24,6 +24,8 @@ func main() {
stateSyncRPCServersStr
string
persistentPeersStr
string
trustHeight
int64
trustHash
string
...
...
@@ -35,6 +37,7 @@ func main() {
flag
.
StringVar
(
&
nodeConfigStr
,
"node-config"
,
""
,
"serialized node config"
)
flag
.
DurationVar
(
&
votingPeriod
,
"voting-period"
,
30000000000
,
"voting period"
)
flag
.
StringVar
(
&
stateSyncRPCServersStr
,
"rpc-servers"
,
""
,
"state sync RPC servers"
)
flag
.
StringVar
(
&
persistentPeersStr
,
"peers"
,
""
,
"state sync RPC servers"
)
flag
.
Int64Var
(
&
trustHeight
,
"trust-height"
,
0
,
"trust Height"
)
flag
.
StringVar
(
&
trustHash
,
"trust-hash"
,
""
,
"trust hash"
)
...
...
@@ -55,11 +58,16 @@ func main() {
panic
(
"rpc-servers is required, separated by commas"
)
}
persistenrPeers
:=
strings
.
Split
(
persistentPeersStr
,
","
)
if
len
(
persistenrPeers
)
==
0
{
panic
(
"persistent peers are required, separated by commas"
)
}
if
err
:=
os
.
MkdirAll
(
dataDir
,
0
o755
);
err
!=
nil
{
panic
(
err
)
}
_
,
err
=
initialization
.
InitSingleNode
(
chainId
,
dataDir
,
existingGenesisDir
,
&
nodeConfig
,
votingPeriod
,
trustHeight
,
trustHash
,
stateSyncRPCServers
)
_
,
err
=
initialization
.
InitSingleNode
(
chainId
,
dataDir
,
existingGenesisDir
,
&
nodeConfig
,
votingPeriod
,
trustHeight
,
trustHash
,
stateSyncRPCServers
,
persistenrPeers
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets