-
Notifications
You must be signed in to change notification settings - Fork 87
feat:add sync test #3026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gpBlockchain
wants to merge
12
commits into
nervosnetwork:develop
Choose a base branch
from
gpBlockchain:feat-test-sync
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat:add sync test #3026
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
74cc411
wip: add sync test for dev node (#2997)
gpBlockchain 22d4369
fix macos sync ci and update light-client sync data (#3013)
gpBlockchain b5f22ea
fix windows ci (#3016)
gpBlockchain 78bc769
chore: Add a option for test sync.
yanguoyu d6f0717
Merge branch 'develop' into feat-test-sync
Keith-CY 4a09242
Update packages/sync-test/src/services/light-runner.ts
gpBlockchain b1b0142
Merge branch 'develop' into feat-test-sync
Keith-CY ae568ba
Merge branch 'develop' into feat-test-sync
Keith-CY 7e4c37d
Update packages/sync-test/src/services/ckb-runner.ts
gpBlockchain fa0d60e
refactor code
gpBlockchain 8fa4c48
Merge branch 'develop' into feat-test-sync
Keith-CY cd0a04b
update ckb start time
gpBlockchain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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" | ||
| } | ||
| } | ||
Keith-CY marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
| @REM curl -O -L http://github-test-logs.ckbapp.dev/neuron/sync/Neuron-v0.111.1-setup.exe | ||
| move .\Neuron-*.exe Neuron-setup.exe | ||
| .\Neuron-setup.exe /S /D=D:\a\neuron\neuron\packages\sync-test\neuron | ||
| 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" |
Binary file not shown.
This file contains hidden or 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 hidden or 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 |
This file contains hidden or 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,76 @@ | ||
|
|
||
| data_dir = 'data' | ||
|
|
||
| [chain] | ||
|
|
||
| spec = { file = 'specs/dev.toml' } | ||
|
|
||
| [logger] | ||
|
|
||
| filter = 'info' | ||
| color = true | ||
| log_to_file = true | ||
| log_to_stdout = true | ||
|
|
||
| [sentry] | ||
|
|
||
| dsn = '' | ||
|
|
||
| [db] | ||
|
|
||
| cache_size = 134217728 | ||
| options_file = 'default.db-options' | ||
|
|
||
| [network] | ||
|
|
||
| listen_addresses = ['/ip4/0.0.0.0/tcp/8115'] | ||
| bootnodes = [] | ||
| max_peers = 125 | ||
| max_outbound_peers = 8 | ||
| ping_interval_secs = 120 | ||
| ping_timeout_secs = 1200 | ||
| connect_outbound_interval_secs = 15 | ||
| upnp = false | ||
| discovery_local_address = true | ||
| bootnode_mode = false | ||
| support_protocols = ['Ping', 'Discovery', 'Identify', 'Feeler', 'DisconnectMessage', 'Sync', 'Relay', 'Time', 'Alert', 'LightClient', 'Filter'] | ||
|
|
||
| [rpc] | ||
|
|
||
| listen_address = '127.0.0.1:8114' | ||
| max_request_body_size = 10485760 | ||
| modules = [ | ||
| 'Net', | ||
| 'Pool', | ||
| 'Miner', | ||
| 'Chain', | ||
| 'Stats', | ||
| 'Subscription', | ||
| 'Experiment', | ||
| 'Debug', | ||
| 'Indexer', | ||
| ] | ||
| reject_ill_transactions = true | ||
| enable_deprecated_rpc = false | ||
|
|
||
| [tx_pool] | ||
|
|
||
| max_tx_pool_size = 180000000 | ||
| min_fee_rate = 1000 | ||
| max_tx_verify_cycles = 70000000 | ||
| max_ancestors_count = 25 | ||
|
|
||
| [store] | ||
|
|
||
| header_cache_size = 4096 | ||
| cell_data_cache_size = 128 | ||
| block_proposals_cache_size = 30 | ||
| block_tx_hashes_cache_size = 30 | ||
| block_uncles_cache_size = 30 | ||
|
|
||
| [block_assembler] | ||
|
|
||
| code_hash = '0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8' | ||
| args = '0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7' | ||
| hash_type = 'type' | ||
| message = '0x' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.