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

Keypath variable in reactor is ignored in trace execution #154

Open
djpesic opened this issue Oct 3, 2022 · 2 comments
Open

Keypath variable in reactor is ignored in trace execution #154

djpesic opened this issue Oct 3, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@djpesic
Copy link

djpesic commented Oct 3, 2022

I am integrating another smart contract example in Atomkraft. I created a reactor stub (comments removed for clarity).

import logging
from typing import Dict

import pytest
from atomkraft.chain import Testnet
from modelator.pytest.decorators import step

keypath = "last_msg.name"


@pytest.fixture
def state():
    return {}

@step("store_cw_contract")
def store_cw_contract(testnet: Testnet, state: Dict, messages):
    logging.info("Step: store_cw_contract")

Variable keypath should override keypath argument inside
atomkraft test trace --trace traces/violation1.itf.json --reactor reactors/reactor.p
but it is not done. In order to use "keypath.name", I have to put in inside arguments like this
atomkraft test trace --trace traces/violation1.itf.json --reactor reactors/reactor.py --keypath "last_msg.name"

@djpesic djpesic changed the title Keypath variable in reactor is ignored Keypath variable in reactor is ignored in trace execution Oct 3, 2022
@ivan-gavran ivan-gavran added the bug Something isn't working label Nov 25, 2022
@ivan-gavran
Copy link
Collaborator

At the moment, we are setting the keypath variable at two places:
a) when generating the reactor
b) when running the test (atomkraft test trace ..).

In the case b), even if we don't set the option --keypath, it will still get set to the default value.

It seems to me that the right place for setting the keypath should be in reactor (which is a connector between the trace and the test).
@hvanz , what do you think?

@hvanz
Copy link
Member

hvanz commented Nov 25, 2022

We should allow both, preferring the reactor first, with the option to override it with --keypath in the CLI. If both are empty, it should fail with a message. We should not provide a default value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants