Skip to content

Commit

Permalink
Fix unit tests and TransactionPayload::deserialize()
Browse files Browse the repository at this point in the history
  • Loading branch information
jbencin committed Dec 6, 2023
1 parent 5c1ce84 commit 396b34b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 32 deletions.
17 changes: 1 addition & 16 deletions stackslib/src/chainstate/stacks/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,7 @@ impl StacksMessageCodec for TransactionPayload {
} else {
return Err(codec_error::DeserializeError("Failed to parse nakamoto coinbase transaction -- did not receive an optional recipient principal value".to_string()));
};
let vrf_proof_bytes: Vec<u8> = read_next(fd)?;
let Some(vrf_proof) = VRFProof::from_bytes(&vrf_proof_bytes) else {
return Err(codec_error::DeserializeError(
"Failed to decode coinbase VRF proof".to_string(),
));
};
let vrf_proof: VRFProof = read_next(fd)?;
TransactionPayload::Coinbase(payload, recipient_opt, Some(vrf_proof))
}
TransactionPayloadID::TenureChange => {
Expand Down Expand Up @@ -2043,11 +2038,6 @@ mod test {
0x12,
// no alt recipient, so Value::none
0x09,
// proof bytes length
0x00,
0x00,
0x00,
0x50,
// proof bytes
0x92,
0x75,
Expand Down Expand Up @@ -2227,11 +2217,6 @@ mod test {
0x61,
0x63,
0x74,
// proof bytes length
0x00,
0x00,
0x00,
0x50,
// proof bytes
0x92,
0x75,
Expand Down
3 changes: 1 addition & 2 deletions stackslib/src/core/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ use stacks_common::util::{get_epoch_time_ms, get_epoch_time_secs};
use crate::burnchains::Txid;
use crate::chainstate::burn::db::sortdb::SortitionDB;
use crate::chainstate::burn::ConsensusHash;
use crate::chainstate::nakamoto::NakamotoBlock;
use crate::chainstate::nakamoto::NakamotoChainState;
use crate::chainstate::nakamoto::{NakamotoBlock, NakamotoChainState};
use crate::chainstate::stacks::db::blocks::MemPoolRejection;
use crate::chainstate::stacks::db::{ClarityTx, StacksChainState};
use crate::chainstate::stacks::events::StacksTransactionReceipt;
Expand Down
3 changes: 1 addition & 2 deletions testnet/stacks-node/src/mockamoto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@ use stacks_common::util::hash::{Hash160, MerkleTree, Sha512Trunc256Sum};
use stacks_common::util::secp256k1::{MessageSignature, SchnorrSignature, Secp256k1PublicKey};
use stacks_common::util::vrf::{VRFPrivateKey, VRFProof, VRFPublicKey, VRF};

use self::signer::SelfSigner;
use crate::neon::Counters;
use crate::neon_node::{
Globals, PeerThread, RelayerDirective, StacksNode, BLOCK_PROCESSOR_STACK_SIZE,
};
use crate::syncctl::PoxSyncWatchdogComms;
use crate::{Config, EventDispatcher};

use self::signer::SelfSigner;

pub mod signer;
#[cfg(test)]
mod tests;
Expand Down
18 changes: 6 additions & 12 deletions testnet/stacks-node/src/mockamoto/tests.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
use std::thread;
use std::time::Duration;
use std::time::Instant;
use std::time::{Duration, Instant};

use clarity::vm::costs::ExecutionCost;
use stacks::chainstate::nakamoto::NakamotoChainState;
use stacks::chainstate::stacks::db::StacksChainState;
use stacks_common::types::chainstate::StacksAddress;
use stacks_common::types::chainstate::StacksPrivateKey;
use stacks_common::types::chainstate::{StacksAddress, StacksPrivateKey};
use stacks_common::types::StacksEpochId;
use stacks_common::util::hash::to_hex;

use crate::config::EventKeyType;
use crate::config::EventObserverConfig;
use super::MockamotoNode;
use crate::config::{EventKeyType, EventObserverConfig};
use crate::neon_node::PeerThread;
use crate::tests::make_stacks_transfer;
use crate::tests::neon_integrations::test_observer;
use crate::tests::to_addr;
use crate::Config;
use crate::ConfigFile;

use super::MockamotoNode;
use crate::tests::{make_stacks_transfer, to_addr};
use crate::{Config, ConfigFile};

#[test]
fn observe_100_blocks() {
Expand Down

0 comments on commit 396b34b

Please sign in to comment.