Skip to content

Commit

Permalink
dismiss get header precompile currently
Browse files Browse the repository at this point in the history
  • Loading branch information
KaoImin committed Aug 4, 2023
1 parent cc596e6 commit c9bcba1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions core/executor/src/precompiles/get_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl PrecompileContract for GetCell {
let (tx_hash, index) = parse_input(input)?;

let root = CURRENT_HEADER_CELL_ROOT.with(|r| *r.borrow());
let cell = ImageCellContract::default()
let cell_opt = ImageCellContract::default()
.get_cell(root, &CellKey { tx_hash, index })
.map_err(|_| err!(_, "get cell"))?
.map(|c| Cell {
Expand All @@ -43,13 +43,16 @@ impl PrecompileContract for GetCell {
is_consumed: c.consumed_number.is_some(),
created_number: c.created_number,
consumed_number: c.consumed_number.unwrap_or_default(),
})
.unwrap_or_default();
});

if cell_opt.is_none() {
return err!("get cell return None");
}

Ok((
PrecompileOutput {
exit_status: ExitSucceed::Returned,
output: cell.encode(),
output: cell_opt.unwrap().encode(),
},
gas,
))
Expand Down
6 changes: 3 additions & 3 deletions core/executor/src/precompiles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ use protocol::types::H160;

use crate::precompiles::{
blake2_f::Blake2F, call_ckb_vm::CallCkbVM, ec_add::EcAdd, ec_mul::EcMul, ec_pairing::EcPairing,
ecrecover::EcRecover, get_cell::GetCell, get_header::GetHeader, identity::Identity,
modexp::ModExp, ripemd160::Ripemd160, sha256::Sha256,
ecrecover::EcRecover, get_cell::GetCell, identity::Identity, modexp::ModExp,
ripemd160::Ripemd160, sha256::Sha256,
};

#[macro_export]
Expand Down Expand Up @@ -96,7 +96,7 @@ const fn axon_precompile_address(addr: u8) -> H160 {
pub fn build_precompile_set() -> BTreeMap<H160, PrecompileFn> {
precompiles!(
EcRecover, Sha256, Ripemd160, Identity, ModExp, EcAdd, EcMul, EcPairing, Blake2F, GetCell,
GetHeader, CallCkbVM
CallCkbVM
)
}

Expand Down

0 comments on commit c9bcba1

Please sign in to comment.