-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: add sync test for dev node (#2997)
Co-authored-by: gpBlockchain
- Loading branch information
1 parent
432f0ec
commit 74cc411
Showing
40 changed files
with
1,818 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jest.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
module.exports = { | ||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
paths: ['src'], | ||
extensions: ['.js', '.ts'], | ||
}, | ||
}, | ||
}, | ||
env: { | ||
es6: true, | ||
node: true, | ||
browser: true, | ||
jest: true, | ||
}, | ||
globals: { | ||
BigInt: 'readonly', | ||
}, | ||
rules: { | ||
// TODO: Some temporarily disabled rules will be re-enabled later, considering that many files are affected and will be addressed in the future. | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'prefer-const': 'off', | ||
|
||
// This is the configuration that was set when using eslint-plugin-prettier | ||
// https://github.com/prettier/eslint-plugin-prettier#arrow-body-style-and-prefer-arrow-callback-issue | ||
'arrow-body-style': 'off', | ||
'prefer-arrow-callback': 'off', | ||
|
||
// TypeScript support | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
argsIgnorePattern: '^_', | ||
}, | ||
], | ||
|
||
// Unnecessary rules | ||
'no-plusplus': 'off', | ||
'max-classes-per-file': 'off', | ||
'@typescript-eslint/no-inferrable-types': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'warn', | ||
'no-console': 'off', | ||
// Adjusted rules | ||
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.test.ts', '*.test.tsx'], | ||
rules: { | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'no-console': 'off', | ||
}, | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
tabWidth: 2, | ||
useTabs: false, | ||
printWidth: 120, | ||
trailingComma: 'es5', | ||
semi: false, | ||
singleQuote: true, | ||
// TODO: This is the previous legacy configuration, should use the default settings, considering that more files are affected, and will be dealt with later. | ||
// https://prettier.io/blog/2020/03/21/2.0.0.html#change-default-value-for-arrowparens-to-always-7430httpsgithubcomprettierprettierpull7430-by-kachkaevhttpsgithubcomkachkaev | ||
arrowParens: 'avoid', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# sync-test | ||
|
||
notice: will remove your neuron config data | ||
|
||
```shell | ||
./scripts/prepare_neuron_macos.sh | ||
yarn | ||
yarn test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
process.env = Object.assign(process.env, { NODE_ENV: undefined }) | ||
|
||
module.exports = { | ||
displayName: 'Unit Tests', | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testRegex: '(/tests/.*.(test|spec))\\.(ts?|js?)$', | ||
transform: { | ||
'^.+\\.ts?$': 'ts-jest', | ||
}, | ||
roots: ['<rootDir>/src/'], | ||
moduleDirectories: ['node_modules', 'src'], | ||
moduleFileExtensions: ['ts', 'js', 'json', 'node'], | ||
// setupFiles: ['<rootDir>/tests/setup.ts'], | ||
moduleNameMapper: { | ||
// FIXME: module mapper causes typeorm errors | ||
// "electron": "<rootDir>/tests/mock/electron.ts", | ||
// "logger": "<rootDir>/tests/mock/logger", | ||
}, | ||
testTimeout: 1800000, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "sync-test", | ||
"productName": "Neuron", | ||
"description": "CKB Neuron Wallet", | ||
"homepage": "https://www.nervos.org/", | ||
"version": "0.112.0", | ||
"private": true, | ||
"author": { | ||
"name": "Nervos Core Dev", | ||
"email": "dev@nervos.org", | ||
"url": "https://github.com/nervosnetwork/neuron" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/nervosnetwork/neuron" | ||
}, | ||
"scripts": { | ||
"sync-test": "jest demo.test.ts" | ||
}, | ||
"dependencies": { | ||
"@types/tar": "6.1.10" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#wget http://github-test-logs.ckbapp.dev/neuron/sync/Neuron-v0.111.1-x86_64.AppImage | ||
cp Neuron-*.AppImage Neuron.AppImage | ||
chmod 777 Neuron.AppImage | ||
./Neuron.AppImage --appimage-extract | ||
mkdir neuron | ||
mv squashfs-root neuron | ||
cp -r neuron/squashfs-root/bin source/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#wget http://github-test-logs.ckbapp.dev/neuron/sync/Neuron-v0.111.1-mac-x64.zip | ||
cp Neuron*.zip Neuron.zip | ||
unzip Neuron.zip | ||
mv Neuron.app neuron | ||
chmod 777 neuron/Contents | ||
cp -r neuron/Contents/bin source/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@REM curl -O -L http://github-test-logs.ckbapp.dev/neuron/sync/Neuron-v0.111.1-setup.exe | ||
copy .\Neuron-*.exe Neuron-setup.exe | ||
@echo off | ||
REM 执行安装程序 | ||
.\Neuron-setup.exe /S /D=D:\a\neuron\neuron\packages\sync-test\neuron | ||
|
||
REM 等待进程执行结束 | ||
:CHECK_LOOP | ||
tasklist | find "Neuron-setup.exe" > nul | ||
if errorlevel 1 ( | ||
echo Neuron install succ | ||
mkdir ".\source\bin" | ||
copy ".\neuron\bin\ckb.exe" ".\source\bin\ckb.exe" | ||
copy ".\neuron\bin\ckb-light-client.exe" ".\source\bin\ckb-light-client.exe" | ||
exit /b 0 | ||
) else ( | ||
timeout /t 5 /nobreak > nul | ||
goto :CHECK_LOOP | ||
) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# chain = "mainnet" | ||
# chain = "testnet" | ||
# chain = "your_path_to/dev.toml" | ||
chain = "../ckb/specs/dev.toml" | ||
|
||
[store] | ||
path = "data/store" | ||
|
||
[network] | ||
path = "data/network" | ||
|
||
listen_addresses = ["/ip4/0.0.0.0/tcp/8118"] | ||
### Specify the public and routable network addresses | ||
# public_addresses = [] | ||
|
||
# Node connects to nodes listed here to discovery other peers when there's no local stored peers. | ||
# When chain.spec is changed, this usually should also be changed to the bootnodes in the new chain. | ||
bootnodes = ["/ip4/127.0.0.1/tcp/8115/p2p/QmShJCAx1RzpEDFwBuQ6noqViNgNuYrYv2KCRhxmNQCe5J"] | ||
|
||
### Whitelist-only mode | ||
# whitelist_only = false | ||
### Whitelist peers connecting from the given IP addresses | ||
# whitelist_peers = [] | ||
|
||
### Enable `SO_REUSEPORT` feature to reuse port on Linux, not supported on other OS yet | ||
# reuse_port_on_linux = true | ||
|
||
max_peers = 125 | ||
max_outbound_peers = 2 | ||
# 2 minutes | ||
ping_interval_secs = 120 | ||
# 20 minutes | ||
ping_timeout_secs = 1200 | ||
connect_outbound_interval_secs = 15 | ||
# If set to true, try to register upnp | ||
upnp = false | ||
# If set to true, network service will add discovered local address to peer store, it's helpful for private net development | ||
discovery_local_address = false | ||
# If set to true, random cleanup when there are too many inbound nodes | ||
# Ensure that itself can continue to serve as a bootnode node | ||
bootnode_mode = false | ||
|
||
[rpc] | ||
# Light client rpc is designed for self hosting, exposing to public network is not recommended and may cause security issues. | ||
# By default RPC only binds to localhost, thus it only allows accessing from the same machine. | ||
listen_address = "127.0.0.1:9000" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
data_dir = 'data' | ||
|
||
[chain] | ||
|
||
spec = { file = 'specs/dev.toml' } | ||
|
||
[logger] | ||
|
||
filter = 'info' | ||
color = true | ||
log_to_file = true | ||
log_to_stdout = true | ||
|
||
[sentry] | ||
|
||
dsn = '' | ||
|
||
[miner.client] | ||
|
||
rpc_url = 'http://127.0.0.1:8114' | ||
block_on_submit = true | ||
poll_interval = 500 | ||
|
||
[[miner.workers]] | ||
|
||
worker_type = 'Dummy' | ||
delay_type = 'Constant' | ||
value = 500 |
Oops, something went wrong.
74cc411
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.
Packaging for test is done in 7295595347