Skip to content
This repository was archived by the owner on Dec 16, 2020. It is now read-only.

DBConn panics are reachable #13

Open
smoelius opened this issue Feb 20, 2020 · 1 comment
Open

DBConn panics are reachable #13

smoelius opened this issue Feb 20, 2020 · 1 comment

Comments

@smoelius
Copy link

The following two panics appear to be reachable through normal use:
https://github.com/trailofbits/x-audit-blockstack-core/blob/e2d3d5bae539d242851620e28129af6c4a9de642/src/vm/database/clarity_db.rs#L77
https://github.com/trailofbits/x-audit-blockstack-core/blob/e2d3d5bae539d242851620e28129af6c4a9de642/src/vm/database/clarity_db.rs#L86
They can be reached by modifying GET_INFO_CONTRACT (used by integration_test_get_info) to feature the following:

        (define-map block-data 
          ((height uint))
          ((stacks-hash (buff 32)) 
           (id-hash (buff 32))
           (btc-hash (buff 32))
           (vrf-seed (buff 32))
           (time uint)
           (miner-address principal)
          )
        )
        (define-private (inner-update-info (height uint))
            (let ((value (tuple 
              (stacks-hash (unwrap-panic (get-block-info? header-hash height)))
              (id-hash (unwrap-panic (get-block-info? id-header-hash height)))
              (btc-hash (unwrap-panic (get-block-info? burnchain-header-hash height)))
              (vrf-seed (unwrap-panic (get-block-info? vrf-seed height)))
              (time (unwrap-panic (get-block-info? time height)))
              (miner-address (unwrap-panic (get-block-info? miner-address height)))
             )))
             (ok (map-set block-data ((height height)) value))))
@kantai
Copy link
Collaborator

kantai commented Feb 24, 2020

Yep -- these were stubbed panics, waiting for a PR to implement those lookups, this was resolved in stacks-network/stacks-core#1249

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants