Skip to content

Commit

Permalink
figure out to use clone_from
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamWuGit committed Sep 13, 2024
1 parent 93967d5 commit 5e7888b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
25 changes: 0 additions & 25 deletions mock/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,29 +516,4 @@ impl MockTransaction {
v
}
}

/// Copy from other MockTransaction instance.
pub fn copy_from(&mut self, other: MockTransaction) -> &mut Self {
self.hash = other.hash;
self.nonce = other.nonce;
self.block_hash = other.block_hash;
self.block_number = other.block_number;
self.transaction_index = other.transaction_index;
self.from = other.from;
self.to = other.to;
self.value = other.value;
self.gas_price = other.gas_price;
self.gas = other.gas;
self.input = other.input;
self.v = other.v;
self.r = other.r;
self.s = other.s;
self.transaction_type = other.transaction_type;
self.access_list = other.access_list;
self.max_priority_fee_per_gas = other.max_priority_fee_per_gas;
self.max_fee_per_gas = other.max_fee_per_gas;
self.chain_id = other.chain_id;

self
}
}
2 changes: 1 addition & 1 deletion zkevm-circuits/src/evm_circuit/execution/begin_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,7 @@ mod test {
.nonce(tx.nonce);
},
|mut txs, _accs| {
txs[0].copy_from(tx.clone());
txs[0].clone_from(tx);
},
|block, _tx| block.number(0xcafeu64),
)
Expand Down

0 comments on commit 5e7888b

Please sign in to comment.