Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Refactor: Use InvokeContext in all Syscalls#21545

Merged
Lichtso merged 7 commits intosolana-labs:masterfrom
Lichtso:refactor/syscalls_invoke_context
Dec 2, 2021
Merged

Refactor: Use InvokeContext in all Syscalls#21545
Lichtso merged 7 commits intosolana-labs:masterfrom
Lichtso:refactor/syscalls_invoke_context

Conversation

@Lichtso
Copy link
Copy Markdown
Contributor

@Lichtso Lichtso commented Dec 1, 2021

Problem

Not all SyscallObjects have invoke_context: Rc<RefCell<&'a mut dyn InvokeContext>>.
Some access the individual properties of InvokeContext in bind_syscall_context_objects() which:

  • Necessitates these individual properties to be wrapped in Rc and RefCell even though the entire &mut InvokeContext is already wrapped
  • Makes it harder to remove the dyn Trait of InvokeContext because of the lifetimes of the involved references

Summary of Changes

  • Moves access to the individual properties of InvokeContext from bind_syscall_context_objects() into the matching SyscallObject::call().
  • Adjusts the syscall tests so that all mock an InvokeContext.

Fixes #

@Lichtso Lichtso force-pushed the refactor/syscalls_invoke_context branch from bd6311b to b1e13e2 Compare December 1, 2021 22:20
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 2, 2021

Codecov Report

Merging #21545 (b1e13e2) into master (1fae3d2) will increase coverage by 0.0%.
The diff coverage is 70.9%.

@@           Coverage Diff            @@
##           master   #21545    +/-   ##
========================================
  Coverage    81.5%    81.6%            
========================================
  Files         506      506            
  Lines      142216   142338   +122     
========================================
+ Hits       116024   116182   +158     
+ Misses      26192    26156    -36     

@Lichtso Lichtso merged commit 6330cbc into solana-labs:master Dec 2, 2021
@Lichtso Lichtso deleted the refactor/syscalls_invoke_context branch December 2, 2021 07:58
@Lichtso Lichtso mentioned this pull request Jan 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant