- 
                Notifications
    You must be signed in to change notification settings 
- Fork 962
Deterministic daemons: CLN_DEV_SET_TIME and CLN_DEV_ENTROPY_SEED #8556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            rustyrussell
  wants to merge
  25
  commits into
  ElementsProject:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
rustyrussell:deterministic-daemons
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Open
            
            Deterministic daemons: CLN_DEV_SET_TIME and CLN_DEV_ENTROPY_SEED #8556
                    rustyrussell
  wants to merge
  25
  commits into
  ElementsProject:master
from
rustyrussell:deterministic-daemons
  
      
      
   
              
            Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    ``` DEBUG lightningd: Got depth change 2->3 for e9e31956f77c3844ee2e6e4607dbfebdee95a9aa549668a7a429b8246a6a29de **BROKEN** lightningd: FATAL SIGNAL 6 (version v25.09-20-g003ba4a) **BROKEN** lightningd: backtrace: common/daemon.c:41 (send_backtrace) 0x619bef20e274 **BROKEN** lightningd: backtrace: common/daemon.c:78 (crashdump) 0x619bef20e408 **BROKEN** lightningd: backtrace: ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 ((null)) 0x7a1ccf24532f **BROKEN** lightningd: backtrace: ./nptl/pthread_kill.c:44 (__pthread_kill_implementation) 0x7a1ccf29eb2c **BROKEN** lightningd: backtrace: ./nptl/pthread_kill.c:78 (__pthread_kill_internal) 0x7a1ccf29eb2c **BROKEN** lightningd: backtrace: ./nptl/pthread_kill.c:89 (__GI___pthread_kill) 0x7a1ccf29eb2c **BROKEN** lightningd: backtrace: ../sysdeps/posix/raise.c:26 (__GI_raise) 0x7a1ccf24527d **BROKEN** lightningd: backtrace: ./stdlib/abort.c:79 (__GI_abort) 0x7a1ccf2288fe **BROKEN** lightningd: backtrace: ./assert/assert.c:96 (__assert_fail_base) 0x7a1ccf22881a **BROKEN** lightningd: backtrace: ./assert/assert.c:105 (__assert_fail) 0x7a1ccf23b516 **BROKEN** lightningd: backtrace: lightningd/peer_control.c:2202 (funding_depth_cb) 0x619bef1ac497 **BROKEN** lightningd: backtrace: lightningd/watch.c:223 (txw_fire) 0x619bef1cfcbf **BROKEN** lightningd: backtrace: lightningd/watch.c:292 (watch_topology_changed) 0x619bef1cffa4 **BROKEN** lightningd: backtrace: lightningd/chaintopology.c:829 (updates_complete) 0x619bef144a8c **BROKEN** lightningd: backtrace: lightningd/chaintopology.c:1047 (get_new_block) 0x619bef14561e ``` Signed-off-by: Rusty Russell <[email protected]>
…w one via splice. This happens if the channel is *not* announcable yet. Then we hit the assertion in funding_depth_cb that the txid is the same as the current funding.txid. Signed-off-by: Rusty Russell <[email protected]> Changelog-EXPERIMENTAL: fixed crash when we splice a channel which hasn't been announced yet.
I got a NULL deref on `infcopy->remote_funding = *inflight->funding->splice_remote_funding` at once point in testing, so this should prevent that from happening. Signed-off-by: Rusty Russell <[email protected]>
…nge. Signed-off-by: Rusty Russell <[email protected]>
We watch if they are to do with a channel, or have outputs going to us, but otherwise we didn't, so we never updated the blockheight in the db. Signed-off-by: Rusty Russell <[email protected]> Changelog-Fixed: JSON-RPC: `listtransactions` now correctly updates `blockheight` for txs created by `sendpsbt` which have no change outputs.
It now simply renames tal names, so it's harmless to do even if we're not going to do memleak detection. Signed-off-by: Rusty Russell <[email protected]>
…eak coverage for any typed hash table. You can now simply add per-tal-object helpers for memleak, but our older pattern required calling memleak functions explicitly during memleak handling. Hash tables in particular need to be dynamically allocated (we override the allocators using htable_set_allocator and assume this), so it makes sense to have a helper macro that does all three. This eliminates a huge amount of code. Signed-off-by: Rusty Russell <[email protected]>
…ames. Incorporate a time: this covers the restart case as well. And make it time_mono(), which doesn't get overridden when we override normal wall time. Signed-off-by: Rusty Russell <[email protected]>
I noticed, because it pulled in randomness routines. Signed-off-by: Rusty Russell <[email protected]>
…tchannelmoves. Signed-off-by: Rusty Russell <[email protected]>
…lock. Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
This was changing all the time when I tried to make autogenerate-rpc-examples.py reproducible. Turns out it was being corrupted (it does suspicious things with pointers); rather than try to diagnose it, I simply rewrote the code to create it only when we need it. Signed-off-by: Rusty Russell <[email protected]>
…LN_DEV_ENTROPY_SEED Only in developer mode, ofc. Notes: 1. We have to move the initialization before the lightningd main trace_start, since that uses pseudorand(). 2. To make the results stable, we need to use per-caller values to randbytes(). Otherwise external timing changes the call order. Signed-off-by: Rusty Russell <[email protected]>
This allows us to override it for deterministic results. Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
…tion for timeouts. This is immune to things like clock changes, and has the convenient side-effect that it will *not* be overridden when we override time for developer purposes. Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Except for tracing, that sticks with time_now(). Signed-off-by: Rusty Russell <[email protected]>
…ith CLN_DEV_ENTROPY_SEED. Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
…istincoming. This ensures that bolt11/bolt12 selection of routehints/blinded paths is always the same. Signed-off-by: Rusty Russell <[email protected]>
…itialblockdownload. Signed-off-by: Rusty Russell <[email protected]>
We have to add a send_and_mine_block() for cases where we want to get a txid and then mine it (for canned blocks, we mine it then figure out which tx it was!). And fix up out-by-one in saving blocks. Signed-off-by: Rusty Russell <[email protected]>
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Depends on #8555
This attempts to make our behavior deterministic, and robust against changes, so we can generate repeatable examples. This is not entirely successful: when we interact with other daemons, timing can be an issue (such as multifundchannel), but it works in a limited way.