-
Notifications
You must be signed in to change notification settings - Fork 607
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 serde for interpreter #1909
implement serde for interpreter #1909
Conversation
} = ExtBytecodeSerde::deserialize(deserializer)?; | ||
|
||
let mut bytecode = Self::new(base); | ||
bytecode.absolute_jump(program_counter); |
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.
Would put a small sanity check above this line, if program_counter >= bytecode.bytecode_len() { panic!("serde pc: {program_counter} is less than bytecode len");
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.
added!
i believe you meant the message to be " is greater than or equal to bytecode len"
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 believe you meant the message to be " is greater than or equal to bytecode len"
Yeah, i edited my msg after i have reread it :D
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.
You did it correctly.
Left few nits, otherwise lgtm
a8d268e
to
8999776
Compare
ah great to hear :) i might dare a second one this weekend :) |
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
* implement serde for interpreter * add bytecode check * remove bytecode check * remove defaults generic params * add sanity check + cargo fmt * modify panic message
I tried to tackle #1890
I am not sure this is correct. To my understanding the instruction_pointer is just a pointer and so i have replaced it with the program counter for serialization which i know is not the same but i also wonder what the value of that pointer is in a different context. To my understanding doing an absolute jump back to that offset should give us the correct instruction_pointer again when deserializing.
I probably need some guidance here, if this is too far from expecatiations please let me know i can also just let it go :)
In case this is correct i probably have to add a test where the instruction_pointer changes i.e a running execution. What is the best way to mock the host, do i have to implement a transaction, block etc. from scratch? @rakita thanks!