Rename sig variables to signature

We'll avoid introducing three-letter terms to free up the namespace
for three-letter acronyms.

But recognize the term "sigverify", a verb, to verify a digital
signature.
This commit is contained in:
Greg Fitzgerald 2018-08-09 09:26:21 -06:00
parent 9d436fc5f8
commit 4a980568ac
10 changed files with 75 additions and 75 deletions

View File

@ -9,7 +9,7 @@ use solana::packet::{to_packets, PacketRecycler};
use solana::sigverify; use solana::sigverify;
use solana::transaction::test_tx; use solana::transaction::test_tx;
fn bench_sig_verify(bencher: &mut Bencher) { fn bench_sigverify(bencher: &mut Bencher) {
let tx = test_tx(); let tx = test_tx();
// generate packet vector // generate packet vector
@ -23,8 +23,8 @@ fn bench_sig_verify(bencher: &mut Bencher) {
} }
fn bench(criterion: &mut Criterion) { fn bench(criterion: &mut Criterion) {
criterion.bench_function("bench_sig_verify", |bencher| { criterion.bench_function("bench_sigverify", |bencher| {
bench_sig_verify(bencher); bench_sigverify(bencher);
}); });
} }

View File

@ -136,11 +136,11 @@ impl Bank {
} }
/// Store the given signature. The bank will reject any transaction with the same signature. /// Store the given signature. The bank will reject any transaction with the same signature.
fn reserve_signature(signatures: &mut HashSet<Signature>, sig: &Signature) -> Result<()> { fn reserve_signature(signatures: &mut HashSet<Signature>, signature: &Signature) -> Result<()> {
if let Some(sig) = signatures.get(sig) { if let Some(signature) = signatures.get(signature) {
return Err(BankError::DuplicateSignature(*sig)); return Err(BankError::DuplicateSignature(*signature));
} }
signatures.insert(*sig); signatures.insert(*signature);
Ok(()) Ok(())
} }
@ -233,7 +233,7 @@ impl Bank {
} }
let bal = option.unwrap(); let bal = option.unwrap();
self.reserve_signature_with_last_id(&tx.sig, &tx.last_id)?; self.reserve_signature_with_last_id(&tx.signature, &tx.last_id)?;
if let Instruction::NewContract(contract) = &tx.instruction { if let Instruction::NewContract(contract) = &tx.instruction {
if contract.tokens < 0 { if contract.tokens < 0 {
@ -241,7 +241,7 @@ impl Bank {
} }
if *bal < contract.tokens { if *bal < contract.tokens {
self.forget_signature_with_last_id(&tx.sig, &tx.last_id); self.forget_signature_with_last_id(&tx.signature, &tx.last_id);
return Err(BankError::InsufficientFunds(tx.from)); return Err(BankError::InsufficientFunds(tx.from));
} else if *bal == contract.tokens { } else if *bal == contract.tokens {
purge = true; purge = true;
@ -271,14 +271,14 @@ impl Bank {
.pending .pending
.write() .write()
.expect("'pending' write lock in apply_credits"); .expect("'pending' write lock in apply_credits");
pending.insert(tx.sig, plan); pending.insert(tx.signature, plan);
} }
} }
Instruction::ApplyTimestamp(dt) => { Instruction::ApplyTimestamp(dt) => {
let _ = self.apply_timestamp(tx.from, *dt); let _ = self.apply_timestamp(tx.from, *dt);
} }
Instruction::ApplySignature(tx_sig) => { Instruction::ApplySignature(signature) => {
let _ = self.apply_signature(tx.from, *tx_sig); let _ = self.apply_signature(tx.from, *signature);
} }
Instruction::NewVote(_vote) => { Instruction::NewVote(_vote) => {
trace!("GOT VOTE! last_id={:?}", &tx.last_id.as_ref()[..8]); trace!("GOT VOTE! last_id={:?}", &tx.last_id.as_ref()[..8]);
@ -470,12 +470,12 @@ impl Bank {
/// Process a Witness Signature. Any payment plans waiting on this signature /// Process a Witness Signature. Any payment plans waiting on this signature
/// will progress one step. /// will progress one step.
fn apply_signature(&self, from: Pubkey, tx_sig: Signature) -> Result<()> { fn apply_signature(&self, from: Pubkey, signature: Signature) -> Result<()> {
if let Occupied(mut e) = self if let Occupied(mut e) = self
.pending .pending
.write() .write()
.expect("write() in apply_signature") .expect("write() in apply_signature")
.entry(tx_sig) .entry(signature)
{ {
e.get_mut().apply_witness(&Witness::Signature, &from); e.get_mut().apply_witness(&Witness::Signature, &from);
if let Some(payment) = e.get().final_payment() { if let Some(payment) = e.get().final_payment() {
@ -524,8 +524,8 @@ impl Bank {
last_id: Hash, last_id: Hash,
) -> Result<Signature> { ) -> Result<Signature> {
let tx = Transaction::new(keypair, to, n, last_id); let tx = Transaction::new(keypair, to, n, last_id);
let sig = tx.sig; let signature = tx.signature;
self.process_transaction(&tx).map(|_| sig) self.process_transaction(&tx).map(|_| signature)
} }
/// Create, sign, and process a postdated Transaction from `keypair` /// Create, sign, and process a postdated Transaction from `keypair`
@ -540,8 +540,8 @@ impl Bank {
last_id: Hash, last_id: Hash,
) -> Result<Signature> { ) -> Result<Signature> {
let tx = Transaction::new_on_date(keypair, to, dt, n, last_id); let tx = Transaction::new_on_date(keypair, to, dt, n, last_id);
let sig = tx.sig; let signature = tx.signature;
self.process_transaction(&tx).map(|_| sig) self.process_transaction(&tx).map(|_| signature)
} }
pub fn get_balance(&self, pubkey: &Pubkey) -> i64 { pub fn get_balance(&self, pubkey: &Pubkey) -> i64 {
@ -692,7 +692,7 @@ mod tests {
let bank = Bank::new(&mint); let bank = Bank::new(&mint);
let pubkey = Keypair::new().pubkey(); let pubkey = Keypair::new().pubkey();
let dt = Utc::now(); let dt = Utc::now();
let sig = bank let signature = bank
.transfer_on_date(1, &mint.keypair(), pubkey, dt, mint.last_id()) .transfer_on_date(1, &mint.keypair(), pubkey, dt, mint.last_id())
.unwrap(); .unwrap();
@ -707,14 +707,14 @@ mod tests {
assert_eq!(bank.get_balance(&pubkey), 0); assert_eq!(bank.get_balance(&pubkey), 0);
// Now, cancel the trancaction. Mint gets her funds back, pubkey never sees them. // Now, cancel the trancaction. Mint gets her funds back, pubkey never sees them.
bank.apply_signature(mint.pubkey(), sig).unwrap(); bank.apply_signature(mint.pubkey(), signature).unwrap();
assert_eq!(bank.get_balance(&mint.pubkey()), 1); assert_eq!(bank.get_balance(&mint.pubkey()), 1);
assert_eq!(bank.get_balance(&pubkey), 0); assert_eq!(bank.get_balance(&pubkey), 0);
// Assert cancel doesn't cause count to go backward. // Assert cancel doesn't cause count to go backward.
assert_eq!(bank.transaction_count(), 1); assert_eq!(bank.transaction_count(), 1);
bank.apply_signature(mint.pubkey(), sig).unwrap(); // <-- Attack! Attempt to cancel completed transaction. bank.apply_signature(mint.pubkey(), signature).unwrap(); // <-- Attack! Attempt to cancel completed transaction.
assert_ne!(bank.get_balance(&mint.pubkey()), 2); assert_ne!(bank.get_balance(&mint.pubkey()), 2);
} }
@ -722,14 +722,14 @@ mod tests {
fn test_duplicate_transaction_signature() { fn test_duplicate_transaction_signature() {
let mint = Mint::new(1); let mint = Mint::new(1);
let bank = Bank::new(&mint); let bank = Bank::new(&mint);
let sig = Signature::default(); let signature = Signature::default();
assert!( assert!(
bank.reserve_signature_with_last_id(&sig, &mint.last_id()) bank.reserve_signature_with_last_id(&signature, &mint.last_id())
.is_ok() .is_ok()
); );
assert_eq!( assert_eq!(
bank.reserve_signature_with_last_id(&sig, &mint.last_id()), bank.reserve_signature_with_last_id(&signature, &mint.last_id()),
Err(BankError::DuplicateSignature(sig)) Err(BankError::DuplicateSignature(signature))
); );
} }
@ -737,12 +737,12 @@ mod tests {
fn test_forget_signature() { fn test_forget_signature() {
let mint = Mint::new(1); let mint = Mint::new(1);
let bank = Bank::new(&mint); let bank = Bank::new(&mint);
let sig = Signature::default(); let signature = Signature::default();
bank.reserve_signature_with_last_id(&sig, &mint.last_id()) bank.reserve_signature_with_last_id(&signature, &mint.last_id())
.unwrap(); .unwrap();
bank.forget_signature_with_last_id(&sig, &mint.last_id()); bank.forget_signature_with_last_id(&signature, &mint.last_id());
assert!( assert!(
bank.reserve_signature_with_last_id(&sig, &mint.last_id()) bank.reserve_signature_with_last_id(&signature, &mint.last_id())
.is_ok() .is_ok()
); );
} }
@ -751,24 +751,24 @@ mod tests {
fn test_has_signature() { fn test_has_signature() {
let mint = Mint::new(1); let mint = Mint::new(1);
let bank = Bank::new(&mint); let bank = Bank::new(&mint);
let sig = Signature::default(); let signature = Signature::default();
bank.reserve_signature_with_last_id(&sig, &mint.last_id()) bank.reserve_signature_with_last_id(&signature, &mint.last_id())
.expect("reserve signature"); .expect("reserve signature");
assert!(bank.has_signature(&sig)); assert!(bank.has_signature(&signature));
} }
#[test] #[test]
fn test_reject_old_last_id() { fn test_reject_old_last_id() {
let mint = Mint::new(1); let mint = Mint::new(1);
let bank = Bank::new(&mint); let bank = Bank::new(&mint);
let sig = Signature::default(); let signature = Signature::default();
for i in 0..MAX_ENTRY_IDS { for i in 0..MAX_ENTRY_IDS {
let last_id = hash(&serialize(&i).unwrap()); // Unique hash let last_id = hash(&serialize(&i).unwrap()); // Unique hash
bank.register_entry_id(&last_id); bank.register_entry_id(&last_id);
} }
// Assert we're no longer able to use the oldest entry ID. // Assert we're no longer able to use the oldest entry ID.
assert_eq!( assert_eq!(
bank.reserve_signature_with_last_id(&sig, &mint.last_id()), bank.reserve_signature_with_last_id(&signature, &mint.last_id()),
Err(BankError::LastIdNotFound(mint.last_id())) Err(BankError::LastIdNotFound(mint.last_id()))
); );
} }

View File

@ -122,11 +122,11 @@ fn send_barrier_transaction(barrier_client: &mut ThinClient, last_id: &mut Hash,
} }
*last_id = barrier_client.get_last_id(); *last_id = barrier_client.get_last_id();
let sig = barrier_client let signature = barrier_client
.transfer(0, &id, id.pubkey(), last_id) .transfer(0, &id, id.pubkey(), last_id)
.expect("Unable to send barrier transaction"); .expect("Unable to send barrier transaction");
let confirmatiom = barrier_client.poll_for_signature(&sig); let confirmatiom = barrier_client.poll_for_signature(&signature);
let duration_ms = duration_as_ms(&transfer_start.elapsed()); let duration_ms = duration_as_ms(&transfer_start.elapsed());
if confirmatiom.is_ok() { if confirmatiom.is_ok() {
println!("barrier transaction confirmed in {}ms", duration_ms); println!("barrier transaction confirmed in {}ms", duration_ms);

View File

@ -191,13 +191,13 @@ fn parse_args() -> Result<WalletConfig, Box<error::Error>> {
Ok(WalletCommand::Pay(tokens, to)) Ok(WalletCommand::Pay(tokens, to))
} }
("confirm", Some(confirm_matches)) => { ("confirm", Some(confirm_matches)) => {
let sig_vec = bs58::decode(confirm_matches.value_of("signature").unwrap()) let signatures = bs58::decode(confirm_matches.value_of("signature").unwrap())
.into_vec() .into_vec()
.expect("base58-encoded signature"); .expect("base58-encoded signature");
if sig_vec.len() == std::mem::size_of::<Signature>() { if signatures.len() == std::mem::size_of::<Signature>() {
let sig = Signature::new(&sig_vec); let signature = Signature::new(&signatures);
Ok(WalletCommand::Confirm(sig)) Ok(WalletCommand::Confirm(signature))
} else { } else {
eprintln!("{}", confirm_matches.usage()); eprintln!("{}", confirm_matches.usage());
Err(WalletError::BadParameter("Invalid signature".to_string())) Err(WalletError::BadParameter("Invalid signature".to_string()))
@ -276,12 +276,12 @@ fn process_command(
// If client has positive balance, spend tokens in {balance} number of transactions // If client has positive balance, spend tokens in {balance} number of transactions
WalletCommand::Pay(tokens, to) => { WalletCommand::Pay(tokens, to) => {
let last_id = client.get_last_id(); let last_id = client.get_last_id();
let sig = client.transfer(tokens, &config.id, to, &last_id)?; let signature = client.transfer(tokens, &config.id, to, &last_id)?;
println!("{}", sig); println!("{}", signature);
} }
// Confirm the last client transaction by signature // Confirm the last client transaction by signature
WalletCommand::Confirm(sig) => { WalletCommand::Confirm(signature) => {
if client.check_signature(&sig) { if client.check_signature(&signature) {
println!("Confirmed"); println!("Confirmed");
} else { } else {
println!("Not found"); println!("Not found");

View File

@ -902,7 +902,7 @@ impl Crdt {
) { ) {
trace!("got updates {}", data.len()); trace!("got updates {}", data.len());
// TODO we need to punish/spam resist here // TODO we need to punish/spam resist here
// sig verify the whole update and slash anyone who sends a bad update // sigverify the whole update and slash anyone who sends a bad update
let mut insert_total = 0; let mut insert_total = 0;
for v in data { for v in data {
insert_total += self.insert(&v); insert_total += self.insert(&v);

View File

@ -173,7 +173,7 @@ impl Entry {
fn add_transaction_data(hash_data: &mut Vec<u8>, tx: &Transaction) { fn add_transaction_data(hash_data: &mut Vec<u8>, tx: &Transaction) {
hash_data.push(0u8); hash_data.push(0u8);
hash_data.extend_from_slice(&tx.sig.as_ref()); hash_data.extend_from_slice(&tx.signature.as_ref());
} }
/// Creates the hash `num_hashes` after `start_hash`. If the transaction contains /// Creates the hash `num_hashes` after `start_hash`. If the transaction contains

View File

@ -48,11 +48,11 @@ impl Signature {
pub fn new(signature_slice: &[u8]) -> Self { pub fn new(signature_slice: &[u8]) -> Self {
Signature(GenericArray::clone_from_slice(&signature_slice)) Signature(GenericArray::clone_from_slice(&signature_slice))
} }
pub fn verify(&self, pubkey_bytes: &[u8], msg_bytes: &[u8]) -> bool { pub fn verify(&self, pubkey_bytes: &[u8], message_bytes: &[u8]) -> bool {
let pubkey = Input::from(pubkey_bytes); let pubkey = Input::from(pubkey_bytes);
let msg = Input::from(msg_bytes); let message = Input::from(message_bytes);
let sig = Input::from(self.0.as_slice()); let signature = Input::from(self.0.as_slice());
signature::verify(&signature::ED25519, pubkey, msg, sig).is_ok() signature::verify(&signature::ED25519, pubkey, message, signature).is_ok()
} }
} }

View File

@ -138,7 +138,7 @@ pub fn ed25519_verify(batches: &[SharedPackets]) -> Vec<Vec<u8>> {
let count = batch_size(batches); let count = batch_size(batches);
// micro-benchmarks show GPU time for smallest batch around 15-20ms // micro-benchmarks show GPU time for smallest batch around 15-20ms
// and CPU speed for 64-128 sig verifies around 10-20ms. 64 is a nice // and CPU speed for 64-128 sigverifies around 10-20ms. 64 is a nice
// power-of-two number around that accounting for the fact that the CPU // power-of-two number around that accounting for the fact that the CPU
// may be busy doing other things while being a real fullnode // may be busy doing other things while being a real fullnode
// TODO: dynamically adjust this crossover // TODO: dynamically adjust this crossover
@ -174,8 +174,8 @@ pub fn ed25519_verify(batches: &[SharedPackets]) -> Vec<Vec<u8>> {
trace!("Starting verify num packets: {}", num); trace!("Starting verify num packets: {}", num);
trace!("elem len: {}", elems.len() as u32); trace!("elem len: {}", elems.len() as u32);
trace!("packet sizeof: {}", size_of::<Packet>() as u32); trace!("packet sizeof: {}", size_of::<Packet>() as u32);
trace!("pub key: {}", (TX_OFFSET + PUB_KEY_OFFSET) as u32); trace!("pubkey: {}", (TX_OFFSET + PUB_KEY_OFFSET) as u32);
trace!("sig offset: {}", (TX_OFFSET + SIG_OFFSET) as u32); trace!("signature offset: {}", (TX_OFFSET + SIG_OFFSET) as u32);
trace!("sign data: {}", (TX_OFFSET + SIGNED_DATA_OFFSET) as u32); trace!("sign data: {}", (TX_OFFSET + SIGNED_DATA_OFFSET) as u32);
trace!("len offset: {}", PACKET_DATA_SIZE as u32); trace!("len offset: {}", PACKET_DATA_SIZE as u32);
unsafe { unsafe {

View File

@ -92,7 +92,7 @@ impl ThinClient {
let data = serialize(&tx).expect("serialize Transaction in pub fn transfer_signed"); let data = serialize(&tx).expect("serialize Transaction in pub fn transfer_signed");
self.transactions_socket self.transactions_socket
.send_to(&data, &self.transactions_addr)?; .send_to(&data, &self.transactions_addr)?;
Ok(tx.sig) Ok(tx.signature)
} }
/// Creates, signs, and processes a Transaction. Useful for writing unit-tests. /// Creates, signs, and processes a Transaction. Useful for writing unit-tests.
@ -227,9 +227,9 @@ impl ThinClient {
} }
/// Poll the server to confirm a transaction. /// Poll the server to confirm a transaction.
pub fn poll_for_signature(&mut self, sig: &Signature) -> io::Result<()> { pub fn poll_for_signature(&mut self, signature: &Signature) -> io::Result<()> {
let now = Instant::now(); let now = Instant::now();
while !self.check_signature(sig) { while !self.check_signature(signature) {
if now.elapsed().as_secs() > 1 { if now.elapsed().as_secs() > 1 {
// TODO: Return a better error. // TODO: Return a better error.
return Err(io::Error::new(io::ErrorKind::Other, "signature not found")); return Err(io::Error::new(io::ErrorKind::Other, "signature not found"));
@ -241,9 +241,9 @@ impl ThinClient {
/// Check a signature in the bank. This method blocks /// Check a signature in the bank. This method blocks
/// until the server sends a response. /// until the server sends a response.
pub fn check_signature(&mut self, sig: &Signature) -> bool { pub fn check_signature(&mut self, signature: &Signature) -> bool {
trace!("check_signature"); trace!("check_signature");
let req = Request::GetSignature { signature: *sig }; let req = Request::GetSignature { signature: *signature };
let data = serialize(&req).expect("serialize GetSignature in pub fn check_signature"); let data = serialize(&req).expect("serialize GetSignature in pub fn check_signature");
let now = Instant::now(); let now = Instant::now();
let mut done = false; let mut done = false;
@ -342,10 +342,10 @@ mod tests {
transactions_socket, transactions_socket,
); );
let last_id = client.get_last_id(); let last_id = client.get_last_id();
let sig = client let signature = client
.transfer(500, &alice.keypair(), bob_pubkey, &last_id) .transfer(500, &alice.keypair(), bob_pubkey, &last_id)
.unwrap(); .unwrap();
client.poll_for_signature(&sig).unwrap(); client.poll_for_signature(&signature).unwrap();
let balance = client.get_balance(&bob_pubkey); let balance = client.get_balance(&bob_pubkey);
assert_eq!(balance.unwrap(), 500); assert_eq!(balance.unwrap(), 500);
exit.store(true, Ordering::Relaxed); exit.store(true, Ordering::Relaxed);
@ -405,8 +405,8 @@ mod tests {
contract.tokens = 502; contract.tokens = 502;
contract.plan = Plan::Budget(Budget::new_payment(502, bob_pubkey)); contract.plan = Plan::Budget(Budget::new_payment(502, bob_pubkey));
} }
let sig = client.transfer_signed(&tr2).unwrap(); let signature = client.transfer_signed(&tr2).unwrap();
client.poll_for_signature(&sig).unwrap(); client.poll_for_signature(&signature).unwrap();
let balance = client.get_balance(&bob_pubkey); let balance = client.get_balance(&bob_pubkey);
assert_eq!(balance.unwrap(), 500); assert_eq!(balance.unwrap(), 500);
@ -452,12 +452,12 @@ mod tests {
transactions_socket, transactions_socket,
); );
let last_id = client.get_last_id(); let last_id = client.get_last_id();
let sig = client let signature = client
.transfer(500, &alice.keypair(), bob_pubkey, &last_id) .transfer(500, &alice.keypair(), bob_pubkey, &last_id)
.unwrap(); .unwrap();
sleep(Duration::from_millis(100)); sleep(Duration::from_millis(100));
assert!(client.check_signature(&sig)); assert!(client.check_signature(&signature));
exit.store(true, Ordering::Relaxed); exit.store(true, Ordering::Relaxed);
server.join().unwrap(); server.join().unwrap();

View File

@ -79,7 +79,7 @@ pub enum Instruction {
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)] #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub struct Transaction { pub struct Transaction {
/// A digital signature of `instruction`, `last_id` and `fee`, signed by `Pubkey`. /// A digital signature of `instruction`, `last_id` and `fee`, signed by `Pubkey`.
pub sig: Signature, pub signature: Signature,
/// The `Pubkey` of the entity that signed the transaction data. /// The `Pubkey` of the entity that signed the transaction data.
pub from: Pubkey, pub from: Pubkey,
@ -104,7 +104,7 @@ impl Transaction {
) -> Self { ) -> Self {
let from = from_keypair.pubkey(); let from = from_keypair.pubkey();
let mut tx = Transaction { let mut tx = Transaction {
sig: Signature::default(), signature: Signature::default(),
instruction, instruction,
last_id, last_id,
from, from,
@ -144,8 +144,8 @@ impl Transaction {
} }
/// Create and sign a new Witness Signature. Used for unit-testing. /// Create and sign a new Witness Signature. Used for unit-testing.
pub fn new_signature(from_keypair: &Keypair, tx_sig: Signature, last_id: Hash) -> Self { pub fn new_signature(from_keypair: &Keypair, signature: Signature, last_id: Hash) -> Self {
let instruction = Instruction::ApplySignature(tx_sig); let instruction = Instruction::ApplySignature(signature);
Self::new_from_instruction(from_keypair, instruction, last_id, 0) Self::new_from_instruction(from_keypair, instruction, last_id, 0)
} }
@ -186,13 +186,13 @@ impl Transaction {
/// Sign this transaction. /// Sign this transaction.
pub fn sign(&mut self, keypair: &Keypair) { pub fn sign(&mut self, keypair: &Keypair) {
let sign_data = self.get_sign_data(); let sign_data = self.get_sign_data();
self.sig = Signature::new(keypair.sign(&sign_data).as_ref()); self.signature = Signature::new(keypair.sign(&sign_data).as_ref());
} }
/// Verify only the transaction signature. /// Verify only the transaction signature.
pub fn verify_sig(&self) -> bool { pub fn verify_signature(&self) -> bool {
warn!("transaction signature verification called"); warn!("transaction signature verification called");
self.sig.verify(&self.from.as_ref(), &self.get_sign_data()) self.signature.verify(&self.from.as_ref(), &self.get_sign_data())
} }
/// Verify only the payment plan. /// Verify only the payment plan.
@ -271,7 +271,7 @@ mod tests {
instruction, instruction,
from: Default::default(), from: Default::default(),
last_id: Default::default(), last_id: Default::default(),
sig: Default::default(), signature: Default::default(),
fee: 0, fee: 0,
}; };
let buf = serialize(&claim0).unwrap(); let buf = serialize(&claim0).unwrap();
@ -292,7 +292,7 @@ mod tests {
} }
} }
assert!(tx.verify_plan()); assert!(tx.verify_plan());
assert!(!tx.verify_sig()); assert!(!tx.verify_signature());
} }
#[test] #[test]
@ -309,7 +309,7 @@ mod tests {
} }
} }
assert!(tx.verify_plan()); assert!(tx.verify_plan());
assert!(!tx.verify_sig()); assert!(!tx.verify_signature());
} }
#[test] #[test]
fn test_layout() { fn test_layout() {
@ -317,7 +317,7 @@ mod tests {
let sign_data = tx.get_sign_data(); let sign_data = tx.get_sign_data();
let tx_bytes = serialize(&tx).unwrap(); let tx_bytes = serialize(&tx).unwrap();
assert_matches!(memfind(&tx_bytes, &sign_data), Some(SIGNED_DATA_OFFSET)); assert_matches!(memfind(&tx_bytes, &sign_data), Some(SIGNED_DATA_OFFSET));
assert_matches!(memfind(&tx_bytes, &tx.sig.as_ref()), Some(SIG_OFFSET)); assert_matches!(memfind(&tx_bytes, &tx.signature.as_ref()), Some(SIG_OFFSET));
assert_matches!(memfind(&tx_bytes, &tx.from.as_ref()), Some(PUB_KEY_OFFSET)); assert_matches!(memfind(&tx_bytes, &tx.from.as_ref()), Some(PUB_KEY_OFFSET));
} }