Skip to content
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

Clarity-Bitcoin V5 #21

Merged
merged 18 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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