Skip to content

Commit 31d0436

Browse files
committed
* update spv type script version.
* remove validation in reset func.
1 parent d650244 commit 31d0436

File tree

5 files changed

+6
-49
lines changed

5 files changed

+6
-49
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

checksums.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
6bbea4820329050e1fc65f9c15cab5948b824c73aa3430d7d92b793c53ca66b6 build/release/can-update-without-ownership-lock
2-
cc121a3fd6244d51aebc12dad7bc0de537aefb84fa870fef7cc02f28f6cbd2f2 build/release/ckb-bitcoin-spv-type-lock
2+
57e463512f0899b2523b4ac6a7e717797a92fdb1b3c565cc5f304bb6001f2656 build/release/ckb-bitcoin-spv-type-lock

contracts/ckb-bitcoin-spv-type-lock/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ckb-bitcoin-spv-type-lock"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
authors = ["Boyu Yang <[email protected]>"]
55
edition = "2021"
66
license = "MIT"

contracts/ckb-bitcoin-spv-type-lock/src/entry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn main() -> Result<()> {
8989
if m == n && m > 2 && m == cells_count && BitcoinChainType::Testnet == flags.into() =>
9090
{
9191
debug!("reset all cells");
92-
operations::reset_cells(&indexes_of_inputs, &indexes_of_outputs, type_args)?;
92+
operations::reset_cells()?;
9393
}
9494
(_m, _n) => {
9595
debug!("unknown operation: {_m} inputs and {_n} outputs");
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,5 @@
1-
use ckb_bitcoin_spv_verifier::types::{core::SpvTypeArgs, packed::SpvInfoReader, prelude::*};
2-
use ckb_std::{ckb_constants::Source, debug, high_level as hl};
3-
4-
use crate::{
5-
error::{InternalError, Result},
6-
utilities,
7-
};
8-
9-
pub(crate) fn reset_cells(
10-
inputs: &[usize],
11-
outputs: &[usize],
12-
type_args: SpvTypeArgs,
13-
) -> Result<()> {
14-
if inputs.windows(2).any(|pair| pair[1] + 1 != pair[0]) {
15-
return Err(InternalError::CreateShouldBeOrdered.into());
16-
}
17-
if outputs.windows(2).any(|pair| pair[1] + 1 != pair[0]) {
18-
return Err(InternalError::CreateShouldBeOrdered.into());
19-
}
20-
// Checks args of the client type script, then returns the clients count;
21-
let _clients_count = {
22-
let clients_count = usize::from(type_args.clients_count);
23-
let cells_count = 1 + clients_count;
24-
if outputs.len() != cells_count {
25-
return Err(InternalError::CreateCellsCountNotMatched.into());
26-
}
27-
let type_id = utilities::load_then_calculate_type_id(outputs.len())?;
28-
if type_id != type_args.type_id.as_ref() {
29-
return Err(InternalError::CreateIncorrectUniqueId.into());
30-
}
31-
clients_count
32-
};
33-
// First cell is the client info cell.
34-
let index = outputs[0];
35-
{
36-
debug!("check client info cell (index={index})");
37-
let output_data = hl::load_cell_data(index, Source::Output)?;
38-
let packed_info = SpvInfoReader::from_slice(&output_data)
39-
.map_err(|_| InternalError::CreateBadInfoCellData)?;
40-
debug!("actual client info cell: {packed_info}");
41-
let info = packed_info.unpack();
42-
if info.tip_client_id != 0 {
43-
return Err(InternalError::CreateInfoIndexShouldBeZero.into());
44-
}
45-
}
1+
use crate::error::Result;
462

3+
pub(crate) fn reset_cells() -> Result<()> {
474
Ok(())
485
}

0 commit comments

Comments
 (0)