Skip to content

Commit 75e2bd6

Browse files
committed
Merge branch 'develop' into feat/add-setup-contracts-to-contract-consensus-test
2 parents d35184e + 1efff8e commit 75e2bd6

File tree

18 files changed

+1996
-22
lines changed

18 files changed

+1996
-22
lines changed

clarity-types/src/errors/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ pub enum RuntimeError {
184184
BadBlockHash(Vec<u8>),
185185
/// Failed to unwrap an `Optional` (`none`) or `Response` (`err` or `ok`) Clarity value.
186186
UnwrapFailure,
187-
/// Attempt to set metadata (e.g., for NFTs or tokens) that was already initialized.
188-
MetadataAlreadySet,
189187
/// Interaction with a deprecated or inactive Proof of Transfer (PoX) contract.
190188
DefunctPoxContract,
191189
/// Attempt to lock STX for stacking when already locked in an active PoX cycle.

clarity/src/vm/database/clarity_db.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -686,25 +686,6 @@ impl<'a> ClarityDatabase<'a> {
686686
.map_err(|e| e.into())
687687
}
688688

689-
/// Set a metadata entry if it hasn't already been set, yielding
690-
/// a runtime error if it was. This should only be called by post-nakamoto
691-
/// contexts.
692-
pub fn try_set_metadata(
693-
&mut self,
694-
contract_identifier: &QualifiedContractIdentifier,
695-
key: &str,
696-
data: &str,
697-
) -> Result<(), VmExecutionError> {
698-
if self.store.has_metadata_entry(contract_identifier, key) {
699-
Err(VmExecutionError::Runtime(
700-
RuntimeError::MetadataAlreadySet,
701-
None,
702-
))
703-
} else {
704-
Ok(self.store.insert_metadata(contract_identifier, key, data)?)
705-
}
706-
}
707-
708689
fn insert_metadata<T: ClaritySerializable>(
709690
&mut self,
710691
contract_identifier: &QualifiedContractIdentifier,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
source: stackslib/src/chainstate/tests/static_analysis_tests.rs
3+
expression: result
4+
---
5+
[
6+
Success(ExpectedBlockOutput(
7+
marf_hash: "4cca742df63dfae2a6082353ebd9528d316f13ae99fb29442bb8e53cc7342565",
8+
evaluated_epoch: Epoch33,
9+
transactions: [
10+
ExpectedTransactionOutput(
11+
tx: "SmartContract(name: bad-map-type-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))",
12+
vm_error: "Some(:0:0: invalid map definition) [NON-CONSENSUS BREAKING]",
13+
return_type: Response(ResponseData(
14+
committed: false,
15+
data: Optional(OptionalData(
16+
data: None,
17+
)),
18+
)),
19+
cost: ExecutionCost(
20+
write_length: 10,
21+
write_count: 1,
22+
read_length: 1,
23+
read_count: 1,
24+
runtime: 1372,
25+
),
26+
),
27+
],
28+
total_block_cost: ExecutionCost(
29+
write_length: 10,
30+
write_count: 1,
31+
read_length: 1,
32+
read_count: 1,
33+
runtime: 1372,
34+
),
35+
)),
36+
Success(ExpectedBlockOutput(
37+
marf_hash: "20140d78c081fb88aa6389b2a11c24b3f98e14832df47562e52210c5145d91cb",
38+
evaluated_epoch: Epoch33,
39+
transactions: [
40+
ExpectedTransactionOutput(
41+
tx: "SmartContract(name: bad-map-type-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))",
42+
vm_error: "Some(:0:0: invalid map definition) [NON-CONSENSUS BREAKING]",
43+
return_type: Response(ResponseData(
44+
committed: false,
45+
data: Optional(OptionalData(
46+
data: None,
47+
)),
48+
)),
49+
cost: ExecutionCost(
50+
write_length: 10,
51+
write_count: 1,
52+
read_length: 1,
53+
read_count: 1,
54+
runtime: 1372,
55+
),
56+
),
57+
],
58+
total_block_cost: ExecutionCost(
59+
write_length: 10,
60+
write_count: 1,
61+
read_length: 1,
62+
read_count: 1,
63+
runtime: 1372,
64+
),
65+
)),
66+
Success(ExpectedBlockOutput(
67+
marf_hash: "00c123e8a822408dad4879b7e9d4158887a1d2750862ed15d3b34cc4cd7cc70b",
68+
evaluated_epoch: Epoch33,
69+
transactions: [
70+
ExpectedTransactionOutput(
71+
tx: "SmartContract(name: bad-map-type-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))",
72+
vm_error: "Some(:0:0: invalid map definition) [NON-CONSENSUS BREAKING]",
73+
return_type: Response(ResponseData(
74+
committed: false,
75+
data: Optional(OptionalData(
76+
data: None,
77+
)),
78+
)),
79+
cost: ExecutionCost(
80+
write_length: 10,
81+
write_count: 1,
82+
read_length: 1,
83+
read_count: 1,
84+
runtime: 1372,
85+
),
86+
),
87+
],
88+
total_block_cost: ExecutionCost(
89+
write_length: 10,
90+
write_count: 1,
91+
read_length: 1,
92+
read_count: 1,
93+
runtime: 1372,
94+
),
95+
)),
96+
Success(ExpectedBlockOutput(
97+
marf_hash: "6feebdbc00848565df5f577460dcf3937f5518e4eb91d228d73d5ed09d3cb8b6",
98+
evaluated_epoch: Epoch33,
99+
transactions: [
100+
ExpectedTransactionOutput(
101+
tx: "SmartContract(name: bad-map-type-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))",
102+
vm_error: "Some(:0:0: invalid map definition) [NON-CONSENSUS BREAKING]",
103+
return_type: Response(ResponseData(
104+
committed: false,
105+
data: Optional(OptionalData(
106+
data: None,
107+
)),
108+
)),
109+
cost: ExecutionCost(
110+
write_length: 10,
111+
write_count: 1,
112+
read_length: 1,
113+
read_count: 1,
114+
runtime: 1372,
115+
),
116+
),
117+
],
118+
total_block_cost: ExecutionCost(
119+
write_length: 10,
120+
write_count: 1,
121+
read_length: 1,
122+
read_count: 1,
123+
runtime: 1372,
124+
),
125+
)),
126+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
source: stackslib/src/chainstate/tests/static_analysis_tests.rs
3+
expression: result
4+
---
5+
[
6+
Success(ExpectedBlockOutput(
7+
marf_hash: "4865d7980ca587867066c6e012ef04e079a89b2e97ef78d3a2248b34c38e3f41",
8+
evaluated_epoch: Epoch33,
9+
transactions: [
10+
ExpectedTransactionOutput(
11+
tx: "SmartContract(name: constructed-list-large-Epoch3_3-Clarity1, code_body: [..], clarity_version: Some(Clarity1))",
12+
vm_error: "Some(:0:0: reached limit of elements in a sequence) [NON-CONSENSUS BREAKING]",
13+
return_type: Response(ResponseData(
14+
committed: false,
15+
data: Optional(OptionalData(
16+
data: None,
17+
)),
18+
)),
19+
cost: ExecutionCost(
20+
write_length: 29,
21+
write_count: 1,
22+
read_length: 1,
23+
read_count: 1,
24+
runtime: 7437,
25+
),
26+
),
27+
],
28+
total_block_cost: ExecutionCost(
29+
write_length: 29,
30+
write_count: 1,
31+
read_length: 1,
32+
read_count: 1,
33+
runtime: 7437,
34+
),
35+
)),
36+
Success(ExpectedBlockOutput(
37+
marf_hash: "69fae186776e92cf6946ed6a4a83c28d0024e0390278df6e68a69e09482d16e7",
38+
evaluated_epoch: Epoch33,
39+
transactions: [
40+
ExpectedTransactionOutput(
41+
tx: "SmartContract(name: constructed-list-large-Epoch3_3-Clarity2, code_body: [..], clarity_version: Some(Clarity2))",
42+
vm_error: "Some(:0:0: reached limit of elements in a sequence) [NON-CONSENSUS BREAKING]",
43+
return_type: Response(ResponseData(
44+
committed: false,
45+
data: Optional(OptionalData(
46+
data: None,
47+
)),
48+
)),
49+
cost: ExecutionCost(
50+
write_length: 29,
51+
write_count: 1,
52+
read_length: 1,
53+
read_count: 1,
54+
runtime: 7436,
55+
),
56+
),
57+
],
58+
total_block_cost: ExecutionCost(
59+
write_length: 29,
60+
write_count: 1,
61+
read_length: 1,
62+
read_count: 1,
63+
runtime: 7436,
64+
),
65+
)),
66+
Success(ExpectedBlockOutput(
67+
marf_hash: "535d3cb64b5043bc386984fce0b0e71ad7c2f703b2f4a91bac5865227642b788",
68+
evaluated_epoch: Epoch33,
69+
transactions: [
70+
ExpectedTransactionOutput(
71+
tx: "SmartContract(name: constructed-list-large-Epoch3_3-Clarity3, code_body: [..], clarity_version: Some(Clarity3))",
72+
vm_error: "Some(:0:0: reached limit of elements in a sequence) [NON-CONSENSUS BREAKING]",
73+
return_type: Response(ResponseData(
74+
committed: false,
75+
data: Optional(OptionalData(
76+
data: None,
77+
)),
78+
)),
79+
cost: ExecutionCost(
80+
write_length: 29,
81+
write_count: 1,
82+
read_length: 1,
83+
read_count: 1,
84+
runtime: 7436,
85+
),
86+
),
87+
],
88+
total_block_cost: ExecutionCost(
89+
write_length: 29,
90+
write_count: 1,
91+
read_length: 1,
92+
read_count: 1,
93+
runtime: 7436,
94+
),
95+
)),
96+
Success(ExpectedBlockOutput(
97+
marf_hash: "7b61f5697e66a568a248c80b83cae3df329c6ef279c3076d441c5d833b71c898",
98+
evaluated_epoch: Epoch33,
99+
transactions: [
100+
ExpectedTransactionOutput(
101+
tx: "SmartContract(name: constructed-list-large-Epoch3_3-Clarity4, code_body: [..], clarity_version: Some(Clarity4))",
102+
vm_error: "Some(:0:0: reached limit of elements in a sequence) [NON-CONSENSUS BREAKING]",
103+
return_type: Response(ResponseData(
104+
committed: false,
105+
data: Optional(OptionalData(
106+
data: None,
107+
)),
108+
)),
109+
cost: ExecutionCost(
110+
write_length: 29,
111+
write_count: 1,
112+
read_length: 1,
113+
read_count: 1,
114+
runtime: 7436,
115+
),
116+
),
117+
],
118+
total_block_cost: ExecutionCost(
119+
write_length: 29,
120+
write_count: 1,
121+
read_length: 1,
122+
read_count: 1,
123+
runtime: 7436,
124+
),
125+
)),
126+
]

0 commit comments

Comments
 (0)