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)
user avatar
  • 3,278
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 ...
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 ...
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 ...
user avatar
  • 883
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.
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 ...
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
user avatar
  • 2,317
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.
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/...
user avatar
  • 31
3 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 ...
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)
user avatar
  • 3,185
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 ...
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 ...
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 ...
user avatar
2 votes
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).
user avatar
  • 3,185
2 votes
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 ...
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.
user avatar
  • 3,185
1 vote

Taquito "estimate" fails with "storage_exhausted.operation"

Resolved! Very simply too (in my case): unsync and re-sync wallet
user avatar
1 vote
Accepted

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

Even though the tests pass it is not actually possible for another contract to use the result of an off-chain view. If you want to use the result in another contract it must be an on-chain view.
user avatar
  • 377
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 ...
user avatar
  • 3,185
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 ...
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. ...
user avatar
  • 3,364
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(.....
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: ...
user avatar
  • 883
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....
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 ...
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.
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 ...
user avatar
  • 3,364
1 vote

Testing frameworks for tezos smart-contracts

You could use Tezster-CLI for setting up local environment and use Tezster-Bundle to develop,deploy and test your contracts. Tezster-CLI: https://github.com/Tezsure/Tezster-CLI Tezster-Bundle: ...
user avatar

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