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

Two conflicting variable definitions crash console #1100

Open
jio-gl opened this issue Jul 24, 2023 · 0 comments
Open

Two conflicting variable definitions crash console #1100

jio-gl opened this issue Jul 24, 2023 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jio-gl
Copy link

jio-gl commented Jul 24, 2023

Describe the bug

When using clarinet console and defining new variables, if two conflicting variables definitions happens on different inputs, this will crash the console:

>> (define-data-var my-number uint u0)
none
>> (define-data-var my-number uint u1)
thread 'main' panicked at 'Metadata entry 'vm-metadata::6::my-number' already exists for contract: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.contract-19', /Users/someuser/.cargo/registry/src/github.com-1ecc6299db9ec823/clarity-vm-2.1.1/./src/vm/database/clarity_db.rs:567:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To Reproduce
Steps to reproduce the behavior:

  1. Run clarinet new my-project && cd my-project
  2. Run 'clarinet console'
  3. Paste contract variable definition '(define-data-var my-number uint u0)'
  4. Paste second contract variable definition (define-data-var my-number uint u1)
  5. main thread panic seen.

Expected behavior

main thread panicking like:

thread 'main' panicked at 'Metadata entry 'vm-metadata::6::my-number' already exists for contract: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.contract-19', /Users/someuser/.cargo/registry/src/github.com-1ecc6299db9ec823/clarity-vm-2.1.1/./src/vm/database/clarity_db.rs:567:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Environment (please complete the following information):

  • OS (version): macOS (13.4.1)
  • Docker version: 23.0.5
  • Clarinet version: 1.7.1

Additional context

Does not seems to affect deployment because a contract with the 2 conflicting definitions gives (err ..) on console integrate deployment. Complete trace follows.

thread 'main' panicked at 'Metadata entry 'vm-metadata::6::my-number' already exists for contract: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.contract-1', /Users/joseignacio/.cargo/registry/src/github.com-1ecc6299db9ec823/clarity-vm-2.1.1/./src/vm/database/clarity_db.rs:567:13
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: clarity::vm::database::clarity_db::ClarityDatabase::create_variable
   3: clarity::vm::eval_all
   4: clarity::vm::contexts::GlobalContext::execute
   5: clarity_repl::repl::interpreter::ClarityInterpreter::execute
   6: clarity_repl::repl::interpreter::ClarityInterpreter::run
   7: clarity_repl::repl::session::Session::eval
   8: clarity_repl::repl::session::Session::formatted_interpretation
   9: clarity_repl::repl::session::Session::run_snippet
  10: clarity_repl::repl::session::Session::handle_command
  11: clarity_repl::frontend::terminal::Terminal::start
  12: clarinet::frontend::cli::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@hugocaillard hugocaillard added this to the Q3-2023 milestone Sep 20, 2023
@hugocaillard hugocaillard added bug Something isn't working good first issue Good for newcomers labels Sep 20, 2023
@hugocaillard hugocaillard modified the milestones: Q3-2023, Q4-2023 Nov 7, 2023
@hugocaillard hugocaillard removed their assignment Nov 7, 2023
@smcclellan smcclellan modified the milestones: Q4-2023, Q1-2024 Jan 16, 2024
@smcclellan smcclellan removed this from the Q1-2024 milestone Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants