-
Notifications
You must be signed in to change notification settings - Fork 0
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
replace parity_wasm #23
Conversation
seems like near runtime cannot parse that wasm module, will fix tomorrow |
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.
LGTM! Nice job!
Just a few comments for some nits.
bin/evm2near/src/compile.rs
Outdated
@@ -195,7 +185,7 @@ impl Compiler { | |||
/// contract's ABI, enabling users to directly call a contract method | |||
/// without going through the low-level `execute` EVM dispatcher. | |||
pub fn emit_abi_methods( | |||
self: &mut Compiler, | |||
self: &mut Compiler<'a>, |
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.
Unrelated to this PR, but I think we could write this simply as &mut self
bin/evm2near/src/compile.rs
Outdated
} | ||
continue; |
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 continue
doesn't seem needed. It's at the bottom of the loop body, so the only thing left to do it continue to the next iteration.
bin/evm2near/src/compile.rs
Outdated
} | ||
continue; |
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.
Same here
bin/evm2near/src/compile.rs
Outdated
} | ||
continue; |
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.
And here
bin/evm2near/src/wasm_translate.rs
Outdated
for tag in tag_section { | ||
let tag = tag?; | ||
let _tag_type = tag_type(&tag)?; | ||
panic!("unspecified section (spec doesnt have that one! WTF)"); |
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.
I wonder if we should make an issue to come back to this when the spec is updated?
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.
as far as i understand, its near wasm runtime limitation at the moment
wasm-core-2 actually support data count section
and tag section appears to be supported in exception proposal
so probably we should follow near runtime instead of wasm spec itself
bin/evm2near/src/wasm_translate.rs
Outdated
} | ||
} | ||
Payload::DataCountSection { count: _, range: _ } => { | ||
panic!("unspecified section (spec doesnt have that one! WTF)"); |
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.
Same here
obsolete parity_wasm lib replaced with wasm-encoder + wasmparser
paritytech/wasm-instrument#3 (comment)
wasm_translate.rs
was initially copied from https://github.com/bytecodealliance/wasm-tools/blob/main/crates/wasm-mutate/src/mutators/translate.rsand murdered after that
there is many things to be redone properly, but general direction (is quite straightforward) will probably remain similar
main pain-points:
parse
func (mostly because of wasm components or non-standard wasm features)Translator::const_expr
&ConstExprKind
)