Skip to content

Unexpected error for undefined variable #6370

@obycode

Description

@obycode

Instead of returning an analysis error for the undefined variable, we get a cost error. For example, if you try to deploy the following very simple contract:

foo

Instead of getting an analysis error about the unresolved variable, foo, the error reported by the miner when mining the deploy transaction is:

Aug 11 18:40:45.235019 INFO Runtime error in contract analysis for ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.foo: Analysis(CheckError { err: CostComputationFailed("Error evaluating result of cost function ST000000000000000000002AMW42H.costs-3.cost_analysis_lookup_variable_depth: Arithmetic(\"log2 must be passed a positive integer\")\n Stack Trace: \n"), expressions: Some([SymbolicExpression { expr: Atom(ClarityName("foo")), id: 1 }]), diagnostic: Diagnostic { level: Error, message: "contract cost computation failed: Error evaluating result of cost function ST000000000000000000002AMW42H.costs-3.cost_analysis_lookup_variable_depth: Arithmetic(\"log2 must be passed a positive integer\")\n Stack Trace: \n", spans: [Span { start_line: 0, start_column: 0, end_line: 0, end_column: 0 }], suggestion: None } }), txid: e9f2d630e5ac44647a0a860dd720f11ae148e8a879dd134e1769199017015c50, AST rules: PrecheckSize

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Status: ✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions