-
Notifications
You must be signed in to change notification settings - Fork 83
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
Implement cosmwasm_vm Move Bind #2553
Implement cosmwasm_vm Move Bind #2553
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
5e84801
to
e6ca471
Compare
a1f34f5
to
97511de
Compare
97511de
to
6079059
Compare
8d1205c
to
70539ea
Compare
…en/bitseed/use-cosm-wasm
@jolestar help review. |
})?; | ||
|
||
// Save WASM bytecode and get checksum | ||
let checksum = WASM_CACHE.save_wasm(&bytecode).map_err(|e| { |
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.
这里的 wasm 最后存哪里去了呢?
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.
The Cache module of cosmwasm-vm is implemented in three layers at the base level:
- Fixed Memory Cache: Modules that are pinned are stored in this cache layer.
- In-Memory Cache: Modules that are not pinned but remain in memory.
- File System Cache: Modules stored on disk.
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.
The third disk storage is the configured system temporary directory.
public fun from_code(code: vector<u8>): Result<Instance, Error> { | ||
features::ensure_wasm_enabled(); | ||
|
||
let store = table::new<String, vector<u8>>(); | ||
let store_handle = table::handle(&store); | ||
|
||
let (checksum, error_code) = native_create_instance(code, store_handle); | ||
if (error_code == 0) { | ||
ok(Instance { | ||
code_checksum: checksum, | ||
store: store, | ||
}) | ||
} else { | ||
table::drop(store); | ||
new_error_result(error_code, string::utf8(b"native_create_instance_error")) | ||
} |
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.
感觉这里应该返回 Object, 这样就不需要那个 table 了,直接把 Object 动态字短作为 store。
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.
Using Object is also possible, but it seems that using Table here makes the logic clearer.
…en/bitseed/use-cosm-wasm
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.
Merge this PR frist, and discuss the refactoring on the dev meeting
OK |
Summary
Summary about this PR
Implement cosmwasm_vm Move Bind #2690
TODO