-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re use contracts wasm compilation #8
Re use contracts wasm compilation #8
Conversation
@@ -237,7 +236,7 @@ where | |||
/// Registers contract code (like uploading wasm bytecode on a chain), | |||
/// so it can later be used to instantiate a contract. | |||
/// Only for wasm codes | |||
pub fn store_wasm_code(&mut self, code: WasmContract) -> u64 { | |||
pub fn store_wasm_code(&mut self, code: Vec<u8>) -> u64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows for cw-multi-test handling of module caching... The interface is also simpler for users
@@ -128,7 +130,7 @@ pub trait Wasm<ExecC, QueryC: CustomQuery>: AllWasmQuerier { | |||
pub type LocalRustContract<ExecC, QueryC> = *mut dyn Contract<ExecC, QueryC>; | |||
pub struct WasmKeeper<ExecC: 'static, QueryC: CustomQuery + 'static> { | |||
/// Contract codes that stand for wasm code in real-life blockchain. | |||
pub code_base: HashMap<usize, WasmContract>, | |||
pub code_base: RefCell<HashMap<usize, WasmContract>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allows for storing new code modules while executing transactions and queries
pub struct DistantCodeId { | ||
pub code_id: u64, | ||
pub module: (Engine, Module), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Engine and Modules go together and MUST be used together, otherwise segmentation faults can happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that's wild Engine that can't be reused with different module
|
||
#[derive(Serialize, Deserialize, Debug)] | ||
#[derive(Debug)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove useless derive
This PR aims at avoiding multiple compilation of wasm modules.