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

Vote for aggregated public key #4116

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a1a6a4c
feat: add check-not-prepare-phase to pox-4
friedger Sep 20, 2023
5ef133e
feat: add check-not-prepare-phase
friedger Nov 23, 2023
03e482f
chore: update boot/pox-4
friedger Nov 23, 2023
6f31254
feat: add event for revoke-delegate-stx
friedger Nov 23, 2023
a99cd10
fix(bns): adjust lease timings for epoch 2.4 simnet compatibility
moodmosaic Nov 24, 2023
8021824
Merge pull request #4087 from moodmosaic/feat/pox-4-simnet-lease-timi…
friedger Nov 28, 2023
097830c
chore: update boot/pox-4
friedger Nov 28, 2023
02ba907
chore: synthesise events for revoke-delegate-stx
friedger Nov 29, 2023
3757a97
feat: add unit tests in clarity
friedger Nov 29, 2023
6f3f983
chore: add log file for flow tests
friedger Nov 30, 2023
915fba7
chore: rename synthesize_pox_event_info, fix prepare phase length
friedger Nov 30, 2023
14c25bd
Merge branch 'next' into feat/pox-4-disallow-stacking-during-prepare-…
friedger Nov 30, 2023
486366b
chore: update pox-4-testnet
friedger Nov 30, 2023
7a3a8f7
chore: add revoke-delegate-stx to get_stacker
friedger Nov 30, 2023
7abb389
chore: push package-lock.json
friedger Dec 1, 2023
c4b0ba7
feat: add pox-4-aggregated-public-key.clar (WIP)
friedger Dec 1, 2023
3068fea
Merge branch 'feat/clarinet-flow-tests' into feat/pox-4-aggregated-pu…
friedger Dec 1, 2023
0304f2c
feat: add number of slots to vote
friedger Dec 3, 2023
117c02a
chore: add second state record
friedger Dec 3, 2023
347804a
chore: replace code with pox-4 contract
friedger Dec 9, 2023
64dbe25
feat: add check-not-prepare-phase to pox-4
friedger Sep 20, 2023
6ed2a25
chore: add check for stacking during prepare phase
friedger Dec 12, 2023
70e8d32
chore: re-add deleted code
friedger Dec 12, 2023
6b603a5
Merge branch 'feat/pox-4-disallow-stacking-during-prepare-phase' into…
friedger Dec 13, 2023
d7459a3
chore: fix typo
friedger Dec 13, 2023
07074b0
chore: move vote clar to pox-4
friedger Dec 15, 2023
9966053
chore: improve use of pox-4 boot code
friedger Dec 16, 2023
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
4 changes: 3 additions & 1 deletion contrib/core-contract-tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ npm-debug.log*
coverage
*.info
costs-reports.json
node_modules
node_modules
*.log.txt
history.txt
24 changes: 24 additions & 0 deletions contrib/core-contract-tests/Clarinet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,27 @@ costs_version = 1
[contracts.bns]
path = "../../stackslib/src/chainstate/stacks/boot/bns.clar"
depends_on = []

[contracts.pox-4]
path = "../../stackslib/src/chainstate/stacks/boot/pox-4.clar"
depends_on = []
clarity = 2
epoch = 2.4

[contracts.pox-helper]
path = "./contracts/pox/pox-helper.clar"
depends_on = []
clarity = 2
epoch = 2.4

[contracts.pox-4-aggregated-public-key_test]
path = "./contracts/pox-tests/pox-4-aggregated-public-key_test.clar"
depends_on = []
clarity = 2
epoch = 2.4

[contracts.bns_flow_test]
path = "./contracts/bns-tests/bns_flow_test.clar"
depends_on = []
clarity = 2
epoch = 2.4
19 changes: 19 additions & 0 deletions contrib/core-contract-tests/contracts/bns-tests/bns_flow_test.clar
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(define-constant ERR_NAMESPACE_NOT_FOUND 1005)

;; @name: test delegation to wallet_2, stacking and revoking
(define-public (test-name-registration)
(begin
;; @caller wallet_1
(unwrap! (contract-call? .bns name-preorder 0x0123456789abcdef01230123456789abcdef0123 u1000000) (err "name-preorder by wallet 1 should succeed"))
;; @caller wallet_2
(unwrap! (contract-call? .bns name-preorder 0x30123456789abcdef01230123456789abcdef012 u1000000) (err "name-preorder by wallet 2 should succeed"))

;; @mine-blocks-before 100
;; @caller wallet_1
(try! (register))
(ok true)))

(define-public (register)
(let ((result (contract-call? .bns name-register 0x123456 0x123456 0x123456 0x)))
(asserts! (is-eq result (err ERR_NAMESPACE_NOT_FOUND)) (err "name-register should fail"))
(ok true)))
10 changes: 10 additions & 0 deletions contrib/core-contract-tests/contracts/bns-tests/bns_test.clar
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
;; @name: test preorder and publish with invalid names
;; @caller: wallet_1
(define-constant ERR_NAMESPACE_NOT_FOUND 1005)

(define-public (test-name-registration)
(begin
(unwrap! (contract-call? .bns name-preorder 0x0123456789abcdef01230123456789abcdef0123 u1000000) (err "preorder should succeeed"))
(let ((result (contract-call? .bns name-register 0x123456 0x123456 0x123456 0x)))
(asserts! (is-eq result (err ERR_NAMESPACE_NOT_FOUND)) (err "registration should fail"))
(ok true))))
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(define-public (test-vote)
(let ((result (contract-call? .pox-4 vote-for-aggregated-public-key 0x u0 u0 (list))))
(asserts! (is-eq result (err u10003)) (err "expected 10003"))
(ok true)))
3 changes: 3 additions & 0 deletions contrib/core-contract-tests/contracts/pox/pox-helper.clar
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

(define-read-only (get-bbh)
burn-block-height)
31 changes: 31 additions & 0 deletions contrib/core-contract-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contrib/core-contract-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@hirosystems/clarinet-sdk": "^1.1.0",
"@stacks/transactions": "^6.9.0",
"chokidar-cli": "^3.0.0",
"path": "^0.12.7",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vitest": "^0.34.4",
Expand Down
8 changes: 4 additions & 4 deletions contrib/core-contract-tests/tests/bns/name_register.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ describe("name revealing workflow", () => {
Cl.tuple({
owner: Cl.standardPrincipal(bob),
["zonefile-hash"]: Cl.bufferFromUtf8(cases[0].zonefile),
["lease-ending-at"]: Cl.some(Cl.uint(16)),
["lease-started-at"]: Cl.uint(6),
["lease-ending-at"]: Cl.some(Cl.uint(simnet.blockHeight + 10)),
["lease-started-at"]: Cl.uint(simnet.blockHeight),
})
);
});
Expand Down Expand Up @@ -589,8 +589,8 @@ describe("register a name again before and after expiration", () => {
Cl.tuple({
owner: Cl.standardPrincipal(charlie),
["zonefile-hash"]: Cl.bufferFromAscii("CHARLIE"),
["lease-ending-at"]: Cl.some(Cl.uint(5029)),
["lease-started-at"]: Cl.uint(5019),
["lease-ending-at"]: Cl.some(Cl.uint(simnet.blockHeight + 10)),
["lease-started-at"]: Cl.uint(simnet.blockHeight),
})
);
});
Expand Down
40 changes: 20 additions & 20 deletions contrib/core-contract-tests/tests/bns/name_register_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Clarinet.test({
],
cases[0].nameOwner.address),
]);
assertEquals(block.height, 2);
assertEquals(block.height, 3);
block.receipts[0].result
.expectErr()
.expectInt(1005);
Expand All @@ -119,7 +119,7 @@ Clarinet.test({
],
cases[1].namespaceOwner.address),
]);
assertEquals(block.height, 3);
assertEquals(block.height, 4);
block.receipts[0].result
.expectOk()
.expectUint(144 + block.height - 1);
Expand All @@ -136,7 +136,7 @@ Clarinet.test({
],
cases[1].namespaceOwner.address),
]);
assertEquals(block.height, 4);
assertEquals(block.height, 5);
block.receipts[0].result
.expectOk()
.expectBool(true);
Expand All @@ -158,7 +158,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 5);
assertEquals(block.height, 6);
block.receipts[0].result
.expectOk()
.expectUint(144 + block.height - 1);
Expand All @@ -174,7 +174,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 6);
assertEquals(block.height, 7);
block.receipts[0].result
.expectErr()
.expectInt(2004);
Expand All @@ -195,7 +195,7 @@ Clarinet.test({
],
cases[0].namespaceOwner.address),
]);
assertEquals(block.height, 7);
assertEquals(block.height, 8);
block.receipts[0].result
.expectOk()
.expectUint(144 + block.height - 1);
Expand All @@ -212,7 +212,7 @@ Clarinet.test({
],
cases[0].namespaceOwner.address),
]);
assertEquals(block.height, 8);
assertEquals(block.height, 9);
block.receipts[0].result
.expectOk()
.expectBool(true);
Expand All @@ -225,7 +225,7 @@ Clarinet.test({
],
cases[0].namespaceOwner.address),
]);
assertEquals(block.height, 9);
assertEquals(block.height, 10);
block.receipts[0].result
.expectOk()
.expectBool(true);
Expand All @@ -244,7 +244,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 10);
assertEquals(block.height, 11);
block.receipts[0].result
.expectErr()
.expectInt(2001);
Expand All @@ -266,7 +266,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 11);
assertEquals(block.height, 12);
block.receipts[0].result
.expectOk()
.expectUint(144 + block.height - 1);
Expand All @@ -282,7 +282,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 12);
assertEquals(block.height, 13);
block.receipts[0].result
.expectErr()
.expectInt(2007);
Expand All @@ -304,7 +304,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 13);
assertEquals(block.height, 14);
block.receipts[0].result
.expectOk()
.expectUint(144 + block.height - 1);
Expand All @@ -320,7 +320,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 14);
assertEquals(block.height, 15);
block.receipts[0].result
.expectErr()
.expectInt(2022);
Expand All @@ -342,7 +342,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 15);
assertEquals(block.height, 16);
block.receipts[0].result
.expectOk()
.expectUint(144 + block.height - 1);
Expand All @@ -358,7 +358,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 16);
assertEquals(block.height, 17);
block.receipts[0].result
.expectOk()
.expectBool(true);
Expand Down Expand Up @@ -388,7 +388,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 17);
assertEquals(block.height, 18);
block.receipts[0].result
.expectErr()
.expectInt(2004);
Expand All @@ -412,7 +412,7 @@ Clarinet.test({
],
charlie.address),
]);
assertEquals(block.height, 18);
assertEquals(block.height, 19);
block.receipts[0].result
.expectOk()
.expectUint(144 + block.height - 1);
Expand All @@ -428,7 +428,7 @@ Clarinet.test({
],
charlie.address),
]);
assertEquals(block.height, 19);
assertEquals(block.height, 20);
block.receipts[0].result
.expectErr()
.expectInt(2004);
Expand All @@ -452,7 +452,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 20);
assertEquals(block.height, 21);
block.receipts[0].result
.expectOk()
.expectUint(144 + block.height - 1);
Expand All @@ -468,7 +468,7 @@ Clarinet.test({
],
bob.address),
]);
assertEquals(block.height, 21);
assertEquals(block.height, 22);
block.receipts[0].result
.expectErr()
.expectInt(3001);
Expand Down
Loading