Skip to content

Commit

Permalink
Merge branch 'develop' into feature/integrated-fee-estimator
Browse files Browse the repository at this point in the history
  • Loading branch information
yangby-cryptape committed Oct 20, 2024
2 parents a6c1a86 + 5aded0a commit 4834161
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 11 deletions.
13 changes: 6 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion script/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,11 @@ where
);
}
Message::InheritedFileDescriptor(vm_id, args) => {
let inherited_fd = self.inherited_fd[&vm_id].clone();
let inherited_fd = if vm_id == ROOT_VM_ID {
Vec::new()
} else {
self.inherited_fd[&vm_id].clone()
};
let (_, machine) = self.ensure_get_instantiated(&vm_id)?;
let FdArgs {
buffer_addr,
Expand Down
6 changes: 6 additions & 0 deletions script/src/verify/tests/ckb_latest/features_since_v2023.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,12 @@ fn check_spawn_index_out_of_bound() {
assert_eq!(result.is_ok(), SCRIPT_VERSION == ScriptVersion::V2);
}

#[test]
fn check_root_inherited_fds() {
let result = simple_spawn_test("testdata/spawn_cases", &[19]);
assert_eq!(result.is_ok(), SCRIPT_VERSION == ScriptVersion::V2);
}

#[test]
fn check_spawn_cycles() {
let script_version = SCRIPT_VERSION;
Expand Down
Binary file modified script/testdata/spawn_cases
Binary file not shown.
13 changes: 13 additions & 0 deletions script/testdata/spawn_cases.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,17 @@ int parent_index_out_of_bound(uint64_t* pid) {
return err;
}

int parent_root_inherited_fds() {
uint64_t fds[2] = {0};
uint64_t length = 2;
int err = ckb_inherited_fds(fds, &length);
CHECK(err);
CHECK2(length == 0, -1);
err = 0;
exit:
return err;
}

int parent_entry(int case_id) {
int err = 0;
uint64_t pid = 0;
Expand Down Expand Up @@ -577,6 +588,8 @@ int parent_entry(int case_id) {
return parent_invaild_index(&pid);
} else if (case_id == 18) {
return parent_index_out_of_bound(&pid);
} else if (case_id == 19) {
return parent_root_inherited_fds();
} else {
CHECK2(false, -2);
}
Expand Down
10 changes: 7 additions & 3 deletions tx-pool/src/component/orphan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ impl OrphanPool {
self.entries.remove(id).map(|entry| {
debug!("remove orphan tx {}", entry.tx.hash());
for out_point in entry.tx.input_pts_iter() {
self.by_out_point
.get_mut(&out_point)
.map(|set| set.remove(id));
if let Some(ids_set) = self.by_out_point.get_mut(&out_point) {
ids_set.remove(id);

if ids_set.is_empty() {
self.by_out_point.remove(&out_point);
}
}
}
entry
})
Expand Down

0 comments on commit 4834161

Please sign in to comment.