Hot answers tagged

11 votes
Accepted

How can I write tests for my smart contracts?

There are several test frameworks coming for Tezos. Ours (Techelson) can be used both from Michelson and from Liquidity. It should be released soon. (I will update this answer when it is released)
lefessan's user avatar
  • 3,308
6 votes

Testing frameworks for tezos smart-contracts

Ad 1. I am not sure whether it is what you look for, but look at: https://smartpy.io/demo/ SmartPy offers different tools: Analytics: elements of the UI in SmartPy.io to analyse smart contracts and ...
Tomasz Waszczyk's user avatar
6 votes
Accepted

How to run unit tests?

You can run all the tests with: dune build @runtest if you want particular tests you need to find their "alias name" dune build @runtest_voting.sh is one of them (That I found with git grep ...
Seb Mondet's user avatar
4 votes

How to run unit tests?

One can go in the src/proto_alpha/lib_protocol/test and run dune runtest, which will execute all unit tests for the protocol alpha, including the ones for voting (those in voting.ml). Another test is ...
Eugen's user avatar
  • 975
4 votes

How can I write tests for my smart contracts?

Tezos environment manager has a contract testing framework planned on the roadmap, you can check the current status at this git repo.
Matej maht0rz Šima's user avatar
4 votes
Accepted

Get number of entries in bigmap

This is not something you will be able to achieve with Taquito (at least not for now, that will change in the future) and you have to use an indexer API. I recommend Better Call Dev API, you can ...
Claude Barde's user avatar
4 votes
Accepted

Testing frameworks for tezos smart-contracts

Here is the preview version of truffle tools for working with smart contacts in Tezos: https://www.trufflesuite.com:8443/docs/tezos/truffle/quickstart
Groxan's user avatar
  • 2,691
4 votes
Accepted

How to deploy my own little network with some Tezos nodes on Docker just for research?

You could use Flextesa In a docker-compose file, it should look like the following: version: '3.6' services: sandbox: image: tqtezos/flextesa:20210316 command: edobox start -P 8732 ...
Rodrigo Quelhas's user avatar
3 votes

How to prepare a Protocol Change Proposal?

The best documentation available for this is: http://tezos.gitlab.io/developer/proposal_testing.html http://tezos.gitlab.io/developer/entering_alpha.html https://gitlab.com/romain.nl/howtos/-/blob/...
romain's user avatar
  • 31
3 votes
Accepted

Why can I not subtract 2 local variables of type nat from each other and assign that result to another local variable in a view in smartpy?

Subtractions are implicitly taken as int due to the possibility of negative results. Therefore, the variable sub is of type int here. To resolve this, wrap sub as sp.as_nat(sub) on the dividend.
Anshu Jalan's user avatar
3 votes
Accepted

How do you set the time of a transfer when testing contracts with SmartPy?

Use now = sp.timestamp(10). We used to allow now = 10 but this is not well typed. (also, obviously, the exception message should be better)
FFF's user avatar
  • 3,250
2 votes
Accepted

How do I call the FA2 balance_of endpoint through Truffle?

As far as I know, you cannot check if the entrypoint returns the balance with JavaScript, because the entrypoint doesn't return a value but emits a transaction. I didn't try it for a FA2 token ...
Claude Barde's user avatar
2 votes

How do I change the originating address in truffle?

I haven't found a solution myself using what is provided by Truffle to do what you want, so here is what I do. I guess you must be using Taquito. In this case, you can use this function to change the ...
Claude Barde's user avatar
2 votes
Accepted

What exactly is tested during Testing Phase of the governance cycle?

During the 48h cycle with the fork chain. The test chain now lasts as long as the third phase of the amendment process, so approximately 3 weeks. They are simply processing the same transactions ...
Raphaël Cauderlier's user avatar
2 votes
Accepted

Completium-cli setMockupNow

actually in mockup mode, the way setMockupNow works does not increase block level. Fortunately a way to increase the block level is by manually calling the baking process. We have added the call ...
Benoit Rognier's user avatar
1 vote
Accepted

How can I assign values for a map-type in an archetype test script?

I think you should try with this: const tmdMap : Array<[ string, Bytes ]> = [[" ", tmdBytes]] In typescript, tuple and array have the same literal []. And here, it is a tuple into an ...
Guillaume Duhamel's user avatar
1 vote

How can I assign values for a map-type in an archetype test script?

The expected type reads "an array of pairs of string and bytes", and [" ", tmdBytes] is just a pair, hence I guess the following value should make ti: const tmdMap : Array<[ ...
Benoit Rognier's user avatar
1 vote

Completium-cli setMockupNow

I don’t have enough stack exchange reputation to comment on your post so I'll just leave this as an answer (even though it isn't much of an answer). There was a bug fix on setmockupnow just a few days ...
Grum's user avatar
  • 145
1 vote
Accepted

Why does unpacking a record that has a key containing bounded data fail with `to_value sp.TBounded` in smartpy?

It is unsafe without a dynamic check. We need to determine what the most natural and/or appropriate decision is (very possibly: continue forbidding it).
FFF's user avatar
  • 3,250
1 vote
Accepted

Why does calling sp.address() with a dynamic value inside an entrypoint fail?

That is not possible, sp.address(x) expects x to be a python string. params.address is a michelson value of type string and michelson does not have any instruction to explicitly cast a string to an ...
Rodrigo Quelhas's user avatar
1 vote
Accepted

Receiving a "doesn't have a comparable type" error when returning a list from an on-chain view

You cannot compare lists in Tezos. However, you can use scenario.verify_equal.
FFF's user avatar
  • 3,250
1 vote

Receiving an "OpenVariant" error when evaluating view result in another contract. How do you use the view response inside a smartpy contract?

There’s a 99% probability that the types don’t match between what the view in your target declares and what your calling contract expects (either input or output). You can check Michelson code in an ...
FFF's user avatar
  • 3,250
1 vote

How do I setup and run a custom network for testing purposes?

I want to do this because as a user this just makes the most sense for testing that the protocol will at least upgrade fine before injecting it on mainnet ( if one so chose ). You don't need a test ...
Raphaël Cauderlier's user avatar
1 vote
Accepted

Any Tezos RPC alternatives suggestions

https://smartpy.io/nodes florencenet is a dead testing network, that's why it doesn't work. You need to use a current testing network RPC. The current testing network mimicking mainnet is hangzhounet. ...
utdrmac's user avatar
  • 3,422
1 vote

Is it possible to test for type exceptions in SmartPy?

sp.catch_exception is used to test when you abort the contract execution with FAILWITH. t is the expected type of the value at the top of the stack when you call sp.failwith(...), <>.open_some(.....
Rodrigo Quelhas's user avatar
1 vote
Accepted

What is causes "Unexpected seed's nonce commitment in block header" when baking in sandbox mode?

The error means that a nonce commitment should have been included in the block, but it was not (or the other way around, it was included, but it was not expected to be included). See here for details: ...
Eugen's user avatar
  • 975
1 vote
Accepted

Test vectors for calculating operation hash

You can test against the data that the official Tezos project uses for regression testing. This file might be of interest: https://gitlab.com/tezos/tezos/-/blob/master/tezt/_regressions/protocol.alpha....
Troels Bjørnskov's user avatar
1 vote

Testnet Fork during Testing Period (Cycles 17-24)

The testnet chain is only to validate the ability for the amendment to occur without any initial adverse effects to the network. These protocols should also run in parallel on a dedicated test chain ...
Stephen Andrews's user avatar
1 vote

Test failures for tezos-p2p on FreeBSD, kern.maxfiles limit exceeded

The code uses IPv6, which must be enabled on the host, and was not in my case.
William Baxter's user avatar
1 vote

Test failures for tezos-p2p on FreeBSD, kern.maxfiles limit exceeded

Make sure you are on most recent code checkout hash: $ git log -1 should give you the hash: 0639894412 (Feb 11 2020) I just did a complete rebuild of the source and I do not have tezos-p2p in the ...
utdrmac's user avatar
  • 3,422

Only top scored, non community-wiki answers of a minimum length are eligible