@@ -117,12 +117,16 @@ impl NakamotoBlock {
117
117
/// Verify that if this shadow block has a coinbase, that its VRF proof is consistent with the leader
118
118
/// public key's VRF key. If there is no coinbase tx, then this is a no-op.
119
119
pub ( crate ) fn check_shadow_coinbase_tx ( & self , mainnet : bool ) -> Result < ( ) , ChainstateError > {
120
- assert ! ( self . is_shadow_block( ) ) ;
120
+ if !self . is_shadow_block ( ) {
121
+ error ! (
122
+ "FATAL: tried to validate non-shadow block in a shadow-block-specific validator"
123
+ ) ;
124
+ panic ! ( ) ;
125
+ }
121
126
122
- // If this block has a coinbase, then verify that its VRF proof was generated by this
123
- // block's miner. We'll verify that the seed of this block-commit was generated from the
124
- // parnet tenure's VRF proof via the `validate_vrf_seed()` method, which requires that we
125
- // already have the parent block.
127
+ // If this shadow block has a coinbase, then verify that it has a VRF proof (which will be
128
+ // verified later) and that its recipient is the burn address. Shadow blocks do not award
129
+ // STX.
126
130
if let Some ( coinbase_tx) = self . get_coinbase_tx ( ) {
127
131
let ( _, recipient_opt, vrf_proof_opt) = coinbase_tx
128
132
. try_as_coinbase ( )
@@ -177,7 +181,12 @@ impl NakamotoBlock {
177
181
tenure_burn_chain_tip : & BlockSnapshot ,
178
182
expected_burn : Option < u64 > ,
179
183
) -> Result < ( ) , ChainstateError > {
180
- assert ! ( self . is_shadow_block( ) ) ;
184
+ if !self . is_shadow_block ( ) {
185
+ error ! (
186
+ "FATAL: tried to validate non-shadow block in a shadow-block-specific validator"
187
+ ) ;
188
+ panic ! ( ) ;
189
+ }
181
190
self . common_validate_against_burnchain ( tenure_burn_chain_tip, expected_burn) ?;
182
191
self . check_tenure_tx ( ) ?;
183
192
self . check_shadow_coinbase_tx ( mainnet) ?;
@@ -257,7 +266,12 @@ impl NakamotoChainState {
257
266
mainnet : bool ,
258
267
chain_id : u32 ,
259
268
) -> Result < ( ) , ChainstateError > {
260
- assert ! ( block. is_shadow_block( ) ) ;
269
+ if !self . is_shadow_block ( ) {
270
+ error ! (
271
+ "FATAL: tried to validate non-shadow block in a shadow-block-specific validator"
272
+ ) ;
273
+ panic ! ( ) ;
274
+ }
261
275
262
276
// this block must already be stored
263
277
if !staging_db. has_shadow_nakamoto_block_with_index_hash ( & block. block_id ( ) ) ? {
@@ -496,7 +510,10 @@ impl NakamotoBlockBuilder {
496
510
) -> Result < ( NakamotoBlock , u64 , ExecutionCost ) , Error > {
497
511
use clarity:: vm:: ast:: ASTRules ;
498
512
499
- debug ! ( "Build Nakamoto block from {} transactions" , txs. len( ) ) ;
513
+ debug ! (
514
+ "Build shadow Nakamoto block from {} transactions" ,
515
+ txs. len( )
516
+ ) ;
500
517
let ( mut chainstate, _) = chainstate_handle. reopen ( ) ?;
501
518
502
519
let mut tenure_cause = None ;
@@ -569,7 +586,7 @@ impl NakamotoBlockBuilder {
569
586
570
587
/// Produce a single-block shadow tenure.
571
588
/// Used by tooling to synthesize shadow blocks in case of an emergency.
572
- /// The details and circumatances will be recorded in an accompanying SIP.
589
+ /// The details and circumstances will be recorded in an accompanying SIP.
573
590
///
574
591
/// `naka_tip_id` is the Stacks chain tip on top of which the shadow block will be built.
575
592
/// `tenure_id_consensus_hash` is the sortition in which the shadow block will be built.
0 commit comments