Skip to content

Commit

Permalink
Merge pull request #21 from friedger/feat/v5
Browse files Browse the repository at this point in the history
Clarity-Bitcoin V5
  • Loading branch information
friedger authored Dec 3, 2023
2 parents 2ff66c1 + f1af18d commit d111e9e
Show file tree
Hide file tree
Showing 31 changed files with 4,095 additions and 1,055 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ contracts/clarity-bitcoin-v2.clar

.test
.coverage

# Ignore Node and NPM files. Added by the clarinet-sdk migration.
logs
*.log
npm-debug.log*
coverage
*.info
costs-reports.json
node_modules
.DS_Store
7 changes: 3 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

{
"deno.enable": true,
"files.eol": "\n"
}
"deno.enable": false,
"files.eol": "\n"
}
37 changes: 22 additions & 15 deletions Clarinet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ authors = []
telemetry = true
cache_dir = './.cache'
requirements = []

[contracts.clarity-bitcoin]
path = 'contracts/clarity-bitcoin.clar'
clarity_version = 2
Expand All @@ -16,42 +15,50 @@ path = 'contracts/clarity-bitcoin-helper.clar'
clarity_version = 2
epoch = 2.1

[contracts.helper]
path = 'contracts/helper.clar'
[contracts.clarity-bitcoin-v5]
path = 'contracts/clarity-bitcoin-v5.clar'
clarity_version = 2
epoch = 2.1

[contracts.send-to-first-input]
path = 'contracts/examples/send-to-first-input.clar'
[contracts.clarity-bitcoin_segwit_test]
path = 'contracts/tests/clarity-bitcoin_segwit_test.clar'
clarity_version = 2
epoch = 2.1

[contracts.send-to-first-input-compact]
path = 'contracts/examples/send-to-first-input-compact.clar'
[contracts.clarity-bitcoin_test]
path = 'contracts/tests/clarity-bitcoin_test.clar'
clarity_version = 2
epoch = 2.1

[contracts.stx-account]
path = 'contracts/helper-stx-account.clar'
[contracts.clarity-bitcoin-read_test]
path = 'contracts/tests/clarity-bitcoin-read_test.clar'
clarity_version = 2
epoch = 2.1

[contracts.stx-oracle]
path = 'contracts/stx-oracle.clar'
[contracts.helper]
path = 'contracts/helper.clar'
clarity_version = 2
epoch = 2.1

[contracts.clarity-bitcoin-helper_test]
path = 'contracts/tests/clarity-bitcoin-helper_test.clar'
clarity_version = 2
epoch = 2.1

[contracts.clarity-bitcoin_test]
path = 'contracts/tests/clarity-bitcoin_test.clar'
[contracts.send-to-first-input-compact]
path = 'contracts/examples/send-to-first-input-compact.clar'
clarity_version = 2
epoch = 2.1

[contracts.clarity-bitcoin_segwit_test]
path = 'contracts/tests/clarity-bitcoin_segwit_test.clar'
[contracts.stx-account]
path = 'contracts/helper-stx-account.clar'
clarity_version = 2
epoch = 2.1

[contracts.stx-oracle]
path = 'contracts/stx-oracle.clar'
clarity_version = 2
epoch = 2.1
[repl.analysis]
passes = ['check_checker']

Expand Down
15 changes: 14 additions & 1 deletion contracts/clarity-bitcoin-v4.clar
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,21 @@
nbits: (get uint32 parsed-nbits),
nonce: (get uint32 parsed-nonce)})))

;; (define-read-only (get-bc-h-hash (bh uint))
;; (get-burn-block-info? header-hash bh))

;; MOCK section
(define-constant DEBUG-MODE true)

(define-map mock-burnchain-header-hashes uint (buff 32))

(define-public (mock-add-burnchain-block-header-hash (burn-height uint) (hash (buff 32)))
(ok (map-set mock-burnchain-header-hashes burn-height hash)))

(define-read-only (get-bc-h-hash (bh uint))
(get-burn-block-info? header-hash bh))
(if DEBUG-MODE (map-get? mock-burnchain-header-hashes bh) (get-burn-block-info? header-hash bh)))

;; END MOCK section

;; Verify that a block header hashes to a burnchain header hash at a given height.
;; Returns true if so; false if not.
Expand Down
Loading

0 comments on commit d111e9e

Please sign in to comment.