From 4ec03d32f7abb7ccf4a7543d5a773ed6e49c0ce4 Mon Sep 17 00:00:00 2001 From: YI Date: Mon, 28 Oct 2024 11:32:42 +0800 Subject: [PATCH 1/2] Correctly set tx_index for funding transaction --- README.md | 9 ++++++++- src/fiber/network.rs | 16 +++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index caf0f06f..bc8e739c 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,14 @@ ckb-cli account export --lock-arg --extended-privkey-path ./ckb/expor head -n 1 ./ckb/exported-key > ./ckb/key ``` -4. Start the node, by default it will output logs to the console, you may redirect it to a file: +4. (Optional) Start your own CKB node. We need a CKB rpc server to query on chain information. The CKB node should have at least version 0.118.0, and with `indexer` service enabled. See [Run a Testnet Node | Nervos CKB](https://docs.nervos.org/docs/node/run-testnet-node) for how to run a ckb testnet node, and change `rpc_url` (under `ckb` section) in `config.yml` file accordingly. You may also use the testnet RPC services URL provided in `config/testnet/config.yml`. + +``` +ckb run --indexer +``` + + +5. Start the node, by default it will output logs to the console, you may redirect it to a file: ``` RUST_LOG=info ./fnn -c config.yml -d . diff --git a/src/fiber/network.rs b/src/fiber/network.rs index 3467266e..66d9f2fc 100644 --- a/src/fiber/network.rs +++ b/src/fiber/network.rs @@ -87,9 +87,9 @@ pub const FIBER_PROTOCOL_ID: ProtocolId = ProtocolId::new(42); pub const DEFAULT_CHAIN_ACTOR_TIMEOUT: u64 = 300000; -// tx index is not returned on older ckb version, using dummy tx index instead. -// Waiting for https://github.com/nervosnetwork/ckb/pull/4583/ to be released. -const DUMMY_FUNDING_TX_INDEX: u32 = 0; +// tx index is not returned on older ckb version, this is a dummy value to indicate that +// the tx index is not available. It is assumed that normal tx will not have such a large index. +const DUMMY_FUNDING_TX_INDEX: u32 = u32::MAX; // This is a temporary way to document that we assume the chain actor is always alive. // We may later relax this assumption. At the moment, if the chain actor fails, we @@ -1931,9 +1931,14 @@ where TxStatus { status: Status::Committed, block_number: Some(block_number), + tx_index, .. }, - }) => (tx, block_number.into(), DUMMY_FUNDING_TX_INDEX), + }) => ( + tx, + block_number.into(), + tx_index.map(Into::into).unwrap_or(DUMMY_FUNDING_TX_INDEX), + ), err => { return Err(Error::InvalidParameter(format!( "Channel announcement transaction {:?} not found or not confirmed, result is: {:?}", @@ -3355,6 +3360,7 @@ where TxStatus { status: Status::Committed, block_number: Some(block_number), + tx_index, .. }, .. @@ -3363,7 +3369,7 @@ where NetworkActorEvent::FundingTransactionConfirmed( outpoint, block_number.into(), - DUMMY_FUNDING_TX_INDEX, + tx_index.map(Into::into).unwrap_or(DUMMY_FUNDING_TX_INDEX), ) } Ok(status) => { From c44a1f621a63828c7e0363d28333a1c28a8797c0 Mon Sep 17 00:00:00 2001 From: YI Date: Thu, 31 Oct 2024 12:50:58 +0800 Subject: [PATCH 2/2] Add ckb version 0.118 0.119 to the test list --- .github/workflows/e2e.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 454f9f05..eb389384 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -17,22 +17,22 @@ jobs: - router-pay - udt-router-pay release: + - "0.119.0" + - "0.118.0" - "0.116.1" - test_env: - - "test" - extra_bru_args: - - "" include: + # We can only override the added matrix variables, so we have to put test_env in the include section. + # Otherwise, the overriding of test_env below will create a new job instead of overriding the existing one. + # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow + # > Note that the original matrix values will not be overwritten, but added matrix values can be overwritten. + - test_env: "test" # add an extra workflow to run udt using the env file xudt-test - workflow: "udt" test_env: "xudt-test" - release: "0.116.1" # add an extra workflow to run 3-nodes-transfer with sha256 hash algorithm - workflow: "3-nodes-transfer" - test_env: "test" - release: "0.116.1" extra_bru_args: "--env-var HASH_ALGORITHM=sha256" - name: e2e test for ${{ matrix.workflow }} --env ${{ matrix.test_env }} ${{ matrix.extra_bru_args }} + name: e2e test for ${{ matrix.workflow }} ${{ matrix.release }} --env ${{ matrix.test_env }} ${{ matrix.extra_bru_args }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2