Skip to content

Commit cb0f697

Browse files
committed
Clear void action return register
1 parent 29862d6 commit cb0f697

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/codegen/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,7 @@ impl CodeGenerator {
15341534
fn generate_terminator(&mut self, terminator: &IrTerminator) -> Result<()> {
15351535
match terminator {
15361536
IrTerminator::Return(None) => {
1537+
self.emit("li a0, 0");
15371538
self.emit_epilogue();
15381539
}
15391540
IrTerminator::Return(Some(operand)) => {

‎src/lib.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16750,6 +16750,11 @@ action transfer(nft: &mut NFT, to: Address) {
1675016750
"fixed-byte set transition should compare the output field to the Address parameter:\n{}",
1675116751
asm
1675216752
);
16753+
assert!(
16754+
asm.contains("li a0, 0\n j .Ltransfer_epilogue"),
16755+
"void action success path must clear a0 before returning to ckb-vm:\n{}",
16756+
asm
16757+
);
1675316758
assert!(action.verifier_obligations.iter().any(|obligation| {
1675416759
obligation.category == "cell-state"
1675516760
&& obligation.feature == "mutable-cell:NFT"

0 commit comments

Comments
 (0)