Skip to content

Commit

Permalink
V118 (#60)
Browse files Browse the repository at this point in the history
* update ci

* fix build check

* format code

* print input

* del pytest.mark.skip

* add pytest.mark.skip

* del pytest.mark.skip

* add  pytest.mark.skip

* Update Makefile

* del pytest.mark.skip

* Update test_get_transaction.py

del pytest.mark.skip

* Update download.py

* Update test_node.py

* formt code

* add source ckb 118 config

* add source ckb 118 config

* add source ckb 118 config

* add default.db-options

* add config test (#61)

* add config test

* add config test

* Gp blockchain patch 5 (#63)

* Create test_tx_pool_info.py

* Update node_fixture.py

* Update download.py

* Create test_14_cycling_attack.py (#64)

* Update test_14_cycling_attack.py

* Update test_14_cycling_attack.py

* preview (#66)

* update ckb-cli adapt ckb v118-rc2

* ckb-cli release ckb v0.118.0

* update upload-artifact@v4, and v2 feiqi

* Lgp/ckb js test (#67)

* add config test

* update tx pool info

* add ckb-js-test

* format code

* format code

* Update test_get_fee_rate_statistics.py

* Update test_get_fee_rate_statistics.py

---------

Co-authored-by: 15168316096 <[email protected]>
Co-authored-by: iu小迷弟 <[email protected]>
  • Loading branch information
3 people authored Sep 26, 2024
1 parent 65e2dbc commit 08f42f5
Show file tree
Hide file tree
Showing 32 changed files with 1,587 additions and 34 deletions.
40 changes: 38 additions & 2 deletions .github/workflows/develop-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ on:
GitBranch:
description: 'ckb -git branch'
default: 'develop'
CLIGitUrl:
description: 'ckb-cli -git url'
default: 'https://github.com/nervosnetwork/ckb-cli.git'
CLIGitBranch:
description: 'ckb-cli -git branch'
default: 'develop'
BuildCKb:
description: 'build ckb'
default: 'true'
BuildCKbCLI:
description: 'build ckb-cli'
default: 'false'
TestCases:
description: 'test case: ex test_cases/ckb_cli'
default: 'all'

permissions:
contents: read
Expand All @@ -30,6 +45,17 @@ jobs:
with:
python-version: "3.10"

- name: Print Input Values
run: |
echo "**Input Values:**"
echo " GitUrl: ${{ github.event.inputs.GitUrl }}"
echo " GitBranch: ${{ github.event.inputs.GitBranch }}"
echo " CLIGitUrl: ${{ github.event.inputs.CLIGitUrl }}"
echo " CLIGitBranch: ${{ github.event.inputs.CLIGitBranch }}"
echo " BuildCKb: ${{ github.event.inputs.BuildCKb }}"
echo " BuildCKbCLI: ${{ github.event.inputs.BuildCKbCLI }}"
echo " TestCases: ${{ github.event.inputs.TestCases }}"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -40,11 +66,21 @@ jobs:
env:
GitUrl: '${{ github.event.inputs.GitUrl }}'
GitBranch: '${{ github.event.inputs.GitBranch }}'
CKBCLIGitUrl: '${{ github.event.inputs.CLIGitUrl }}'
CKBCLIGitBranch: '${{ github.event.inputs.CLIGitBranch }}'
BuildCKb: '${{ github.event.inputs.BuildCKb }}'
BuildCKbCLI: '${{ github.event.inputs.BuildCKbCLI }}'


- name: Run tests
run: make test

run: |
if [ "${{ env.TestCases }}" == "all" ]; then
make test
else
make develop_test
fi
env:
TestCases: '${{ github.event.inputs.TestCases }}'

- name: Publish reports
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- name: Publish reports
if: failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: jfoa-build-reports-${{ runner.os }}
path: ./report
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ develop_prepare:

python3 -m download_ckb_light_client
echo "install ckb cli"
sh develop_prepare.sh
bash develop_prepare.sh

test_cases := \
test_cases/replace_rpc \
Expand All @@ -37,7 +37,11 @@ test_cases := \
test_cases/soft_fork \
test_cases/issue \
test_cases/tx_pool_refactor \
test_cases/feature
test_cases/feature \
test_cases/config \
test_cases/miner \
test_cases/get_fee_rate_statistics


test:
@failed_cases=; \
Expand All @@ -53,6 +57,20 @@ test:
exit 1; \
fi

develop_test:
@failed_cases=; \
for test_case in $(TestCases); do \
echo "Running tests for $$test_case"; \
if ! bash test.sh "$$test_case"; then \
echo "$$test_case" >> failed_test_cases.txt; \
fi \
done; \
if [ -s failed_test_cases.txt ]; then \
echo "Some test cases failed: $$(cat failed_test_cases.txt)"; \
rm -f failed_test_cases.txt; \
exit 1; \
fi


clean:
pkill ckb
Expand Down
35 changes: 27 additions & 8 deletions develop_prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,34 @@ set -e
# make prod
# cp target/release/ckb-cli ../source/ckb-cli
# cd ../
DEFAULT_BRANCH="develop"
DEFAULT_URL="https://github.com/nervosnetwork/ckb.git"
DEFAULT_CKB_BRANCH="develop"
DEFAULT_CKB_URL="https://github.com/nervosnetwork/ckb.git"
DEFAULT_BUILD_CKB=false

GitBranch="${GitBranch:-$DEFAULT_BRANCH}"
GitUrl="${GitUrl:-$DEFAULT_URL}"
DEFAULT_CKB_CLI_BRANCH="develop"
DEFAULT_CKB_CLI_URL="https://github.com/nervosnetwork/ckb-cli.git"
DEFAULT_BUILD_CKB_CLI=false


GitCKBBranch="${GitBranch:-$DEFAULT_CKB_BRANCH}"
GitCKBUrl="${GitUrl:-$DEFAULT_CKB_URL}"
GitCKBCLIBranch="${CKBCLIGitBranch:-$DEFAULT_CKB_CLI_BRANCH}"
GitCKBCLIUrl="${CKBCLIGitUrl:-$DEFAULT_CKB_CLI_URL}"
BUILD_CKB="${BuildCKb:-$DEFAULT_BUILD_CKB}"
BUILD_CKB_CLI="${BuildCKbCLI:-$DEFAULT_BUILD_CKB_CLI}"
if [ "$BUILD_CKB" == "true" ]; then
git clone -b $GitCKBBranch $GitCKBUrl
cd ckb
make prod
cp target/prod/ckb ../download/0.117.0/ckb
cd ../
fi
cp download/0.110.2/ckb-cli ./source/ckb-cli-old
if [ "$BUILD_CKB_CLI" == "true" ]; then
git clone -b $GitCKBCLIBranch $GitCKBCLIUrl
cd ckb-cli
make prod
cp target/release/ckb-cli ../source/ckb-cli
exit 0
fi
cp download/0.117.0/ckb-cli ./source/ckb-cli
git clone -b $GitBranch $GitUrl
cd ckb
make prod
cp target/prod/ckb ../download/0.117.0/ckb
1 change: 1 addition & 0 deletions download.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"0.115.0",
"0.116.1",
"0.117.0",
"0.118.0",
] # Replace with your versions

DOWNLOAD_DIR = "download"
Expand Down
23 changes: 23 additions & 0 deletions framework/helper/ckb_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,3 +1045,26 @@ def sync_state(

cmd = f"export API_URL={api_url} && {cli_path} {cmd}"
return json.loads(run_command(cmd))


def clear_tx_verify_queue(
raw_data=False,
no_color=False,
debug=False,
local_only=False,
output_format="json",
api_url="http://127.0.0.1:8114",
):
cmd = "rpc clear_tx_verify_queue"
if raw_data:
cmd += " --raw-data"
if no_color:
cmd += " --no-color"
if debug:
cmd += " --debug"
if local_only:
cmd += " --local-only"
cmd += f" --output-format {output_format}"

cmd = f"export API_URL={api_url} && {cli_path} {cmd}"
return json.loads(run_command(cmd))
13 changes: 12 additions & 1 deletion framework/helper/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def invoke_ckb_contract(
data="0x",
fee=1000,
api_url="http://127.0.0.1:8114",
cell_deps=[],
):
"""
Expand Down Expand Up @@ -198,6 +199,7 @@ def invoke_ckb_contract(
tx_init(tmp_tx_file, api_url)
tx_add_multisig_config(account_address, tmp_tx_file, api_url)
# add input
heads = set()
for i in range(len(input_cell_out_points)):
input_cell_out_point = input_cell_out_points[i]
tx_add_input(
Expand All @@ -206,8 +208,15 @@ def invoke_ckb_contract(
tmp_tx_file,
api_url,
)
transaction = RPCClient(api_url).get_transaction(
input_cell_out_point["tx_hash"]
)
heads.add(transaction["tx_status"]["block_hash"])
transaction = RPCClient(api_url).get_transaction(contract_out_point_tx_hash)
tx_add_header_dep(transaction["tx_status"]["block_hash"], tmp_tx_file)
heads.add(transaction["tx_status"]["block_hash"])
for head in heads:
print("add header:", head)
tx_add_header_dep(head, tmp_tx_file)
# add output
tx_add_type_out_put(
output_cell["type"]["code_hash"],
Expand All @@ -219,6 +228,8 @@ def invoke_ckb_contract(
)
# add dep
tx_add_cell_dep(cell_dep["tx_hash"], cell_dep["index"], tmp_tx_file)
for cell_dep_tmp in cell_deps:
tx_add_cell_dep(cell_dep_tmp["tx_hash"], cell_dep_tmp["index"], tmp_tx_file)
# sign
sign_data = tx_sign_inputs(account_private, tmp_tx_file, api_url)
tx_add_signature(
Expand Down
3 changes: 3 additions & 0 deletions framework/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ def get_raw_tx_pool(self, verbose=None):
def clear_tx_pool(self):
return self.call("clear_tx_pool", [])

def clear_tx_verify_queue(self):
return self.call("clear_tx_verify_queue", [])

def generate_block(self):
return self.call("generate_block", [])

Expand Down
28 changes: 21 additions & 7 deletions framework/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,31 @@

class CkbNodeConfigPath(Enum):
CURRENT_TEST = (
"source/template/ckb/v117/ckb.toml.j2",
"source/template/ckb/v117/ckb-miner.toml.j2",
"source/template/ckb/v117/specs/dev.toml",
"download/0.117.0",
"source/template/ckb/v118/ckb.toml.j2",
"source/template/ckb/v118/ckb-miner.toml.j2",
"source/template/ckb/v118/specs/dev.toml",
"download/0.118.0",
)

CURRENT_MAIN = (
"source/template/ckb/v117/ckb.toml.j2",
"source/template/ckb/v117/ckb-miner.toml.j2",
"source/template/ckb/v118/ckb.toml.j2",
"source/template/ckb/v118/ckb-miner.toml.j2",
"source/template/specs/mainnet.toml.j2",
"download/0.117.0",
"download/0.118.0",
)

PREVIEW_DUMMY = (
"source/template/ckb/v118/ckb.toml.j2",
"source/template/ckb/v118/ckb-miner.toml.j2",
"source/template/specs/preview_dev.toml",
"download/0.118.0",
)

v118 = (
"source/template/ckb/v118/ckb.toml.j2",
"source/template/ckb/v118/ckb-miner.toml.j2",
"source/template/ckb/v118/specs/dev.toml",
"download/0.118.0",
)

v117 = (
Expand Down
16 changes: 8 additions & 8 deletions prepare.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
set -e
# git clone https://github.com/nervosnetwork/ckb-cli.git
# cd ckb-cli
# git checkout pkg/v1.7.0
# make prod
# cp target/release/ckb-cli ../source/ckb-cli
# cd ../
cp download/0.110.2/ckb-cli ./source/ckb-cli-old
cp download/0.117.0/ckb-cli ./source/ckb-cli
git clone https://github.com/nervosnetwork/ckb-cli.git
cd ckb-cli
git checkout develop
make prod
cp target/release/ckb-cli ../source/ckb-cli
cd ../
cp download/0.110.2/ckb-cli ./source/ckb-cli-old
#cp download/0.117.0/ckb-cli ./source/ckb-cli
#git clone https://github.com/quake/ckb-light-client.git
#cd ckb-light-client
#git checkout quake/fix-set-scripts-partial-bug
Expand Down
Binary file added source/contract/js_vm/ckb-js-vm
Binary file not shown.
Loading

0 comments on commit 08f42f5

Please sign in to comment.