0

Is there a way to control what NOW returns in the mock-up mode?

If not, this could be done via a special command in the client to increase it. This seems important for testing.

2

The mockup mode saves its context in a JSON file, I have not checked but I think that editing the context/shell_header/timestamp entry affects the value returned by the NOW instruction.

2
  • That's one way to do it, but could you confirm that there isn't indeed a command to do it directly from the tezos-client? – Arthur B May 17 at 18:24
  • To the best of my knowledge there is no command. There is an open issue on adding a flag to the run script command for that: gitlab.com/tezos/tezos/-/issues/718 – Raphaël Cauderlier May 18 at 11:42
0

The initial timestamp used by mockup mode can be modified by passing an appropriately formatted protocol constants configuration file when creating the mockup. See the documentation here. In particular, it is the initial_timestamp that should be modified.

protocol-constants.json:

{
  "preserved_cycles": 2,
<... snip for brevity ...>  
  "chain_id": "NetXynUjJNZm7wi",
  "initial_timestamp": "1988-01-12T00:00:00Z"
}

and then,

$ tezos-client -mode mockup --base-dir ~/.tezos-mockup create mockup \
              --protocol-constants protocol-constants.json

Now,

 $ tezos-client -mode mockup --base-dir ~/.tezos-mockup \
              get timestamp
 1988-01-12T00:00:00Z                  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.