Skip to main content

Questions tagged [testing]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
17 views

How to execute transactions from Root within a "fork locally" chain within Polkadot.js UI?

I'm trying to test XCM using Chopsticks but running into issues. One workaround I'm trying is to use Polkadot.js UI's "Fork Locally" option. I know several accounts are built in (Alice, Bob, ...
spazcoin's user avatar
0 votes
1 answer
36 views

Zombienet js script weird behaviour

I got the latest binary of polkadot(v1.10.0) by running zombienet setup and set up the following test files: 0001-network.toml [settings] timeout = 1000 [relaychain] default_image = "{{...
Szegoo's user avatar
  • 657
0 votes
0 answers
51 views

Bittensor Subtensor Chain

Does anyone know how to run a public subtensor node and synchronize with Bittensor network on nakamoto instead of the current finney ? There are some nodes currently running on nakamoto chain. I am ...
kapitankot's user avatar
0 votes
0 answers
13 views

Testing pallet_democracy proposal enactment

I am testing a pallet using the democracy pallet, and I am struggling with the enactment step. First of all, the proposal is correctly enacted when using the pallet in polkadot.js: the problem occurs ...
Kazunobu Ndong's user avatar
0 votes
1 answer
49 views

Issue building substrate on linux

I'm trying to run the substrate tests with cargo test --workspace but seeing the following errors on linux (it works on a mac): error: proc macro panicked --> substrate/frame/support/src/lib.rs:...
philoniare's user avatar
0 votes
2 answers
59 views

Wrong Proposal Weight in collective pallet tests

I have a pallet using the propose extrinsic of the collective pallet. one of the parameter of this extrinsic is length_bound which I define as follows: let proposal_len:u32 = proposal.using_encoded(|p|...
Kazunobu Ndong's user avatar
0 votes
1 answer
39 views

None of the tests of pallet-template is running

When I run cargo test, it shows in console that: running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s for node-template, pallet-template and ...
MinhK's user avatar
  • 125
0 votes
0 answers
23 views

How can I manually build message in ink-e2e test?

I would like to manually build a message and send it in my ink-e2e test. I'd like to construct and pass a selector and call data by myself. How can I do it using ink 5.0.0-rc and ink-e2e 5.0.0-rc?
Yrefef's user avatar
  • 75
0 votes
0 answers
11 views

How to call function with the same name but from different trait inside ink-e2e-test

Let's say I have the following impl of my Contract: impl Contract{ #[ink(message)] pub fn my_fun(&self); } impl MyTrait1 for Contract { #[ink(message)] pub fn my_fun(&self); } ...
Yrefef's user avatar
  • 75
0 votes
0 answers
33 views

Ink e2e tests with custom environment

I have an ink! contract that uses a custom environment that contains custom chain extensions. I am trying to write e2e tests for this contract however there is a problem. Instantiate the contract how ...
Szegoo's user avatar
  • 657
0 votes
1 answer
64 views

Build fast-runtime for kusama on PolkadotSDK

Im quite a newbie in the new polkadot-sdk, can sm1 guide me how can I build a fast-runtime kusama polkadot image? When I try to run a polkadot build with fast-runtime with kusama-local spec it tells: ...
Gonzalo Cerro's user avatar
1 vote
1 answer
69 views

Differences between xcm-simulator and xcm-emulator

I'm trying to have a deep understanding of the differences between xcm-simulator and xcm-emulator. I understand that xcm-emulator is "less mocked" than xcm-simulator. But because when using ...
magecnion's user avatar
  • 242
1 vote
0 answers
35 views

Testing & pallet_collective

I have a pallet that is using the pallet_collective to trigger votes for roles affectations requests. everything works fine in the polkadot.js interface, but testing is not going as expected. in the ...
Kazunobu Ndong's user avatar
1 vote
2 answers
225 views

How to print / output from within async tokio test

I am writing a new test and when I run this code, the println's do not output in the terminal. #[tokio::test] async fn can_fetch_child_keys() { if std::option_env!("TEST_WS").is_none() { ...
Bruno's user avatar
  • 8,365
0 votes
0 answers
15 views

How to test smart contract timestamp dependent behavior?

how can I test block_timestamp-dependent smart contract behavior? The substrate contact node doesn't allow block_timestamp manipulations. For context, in the EVM ecosystem, one can use hardhat helpers ...
Yrefef's user avatar
  • 75
0 votes
1 answer
21 views

Creation of account ids

A brief context: I want to deliver the test. The exact context: Creation of account_id's (first point in an outline). Question: Do I correctly create account_id in the context of my task. Should I ...
Tomasz Waszczyk's user avatar
2 votes
1 answer
77 views

Testing benchmarks with V2

Im writing benchmarks for a pallet using benchmarking version 2. And it seems I cant call Pallet::<Test>::test_benchmarks_"extrinsic_name" inside of a test anymore. Is it no longer ...
Xavier's user avatar
  • 415
1 vote
0 answers
61 views

Automating Sync Tests for a Substrate Node: Best Approaches?

I am working on a Substrate node that needs to sync with specific live networks. My goal is to ensure that the node is able to initiate and maintain synchronization with these networks, and I would ...
ALeSD's user avatar
  • 499
1 vote
0 answers
21 views

e2e-tests We should find port before reader ends - ink! 4.2.1, rust 1.69, cargo contracts 3.0.1

I have the same problem and error message as described here: e2e-tests "We should find a port before the reader ends" for rust = 1.69 and cargo-contract-contract 3.0.1-unknown-x86_64-apple-...
ryvers's user avatar
  • 11
1 vote
0 answers
24 views

How to resolve "mismatched types" error while ink_e2e test : expected String, found Vec<u8>

I am working with ink_e2e testing framework in ink smart contract, and I have encountered an error message that's a bit confusing. The error says: mismatched types - expected String, found Vec<u8&...
the dev's user avatar
  • 477
1 vote
1 answer
51 views

Simulate block finalization error

I would like to simulate how our parachain reacts to events like, A collator produces a block that is not accepted by other collators in that parachain. Aka a malicious collator. The relay chain ...
Gonzalo Cerro's user avatar
2 votes
2 answers
52 views

How to get Error from different pallet in test?

In tests we use following statement to check error: assert_noop!( ProfileValidation::add_citizen(RuntimeOrigin::signed(1), content.clone()), Error::<Test>::...
Amiya Behera's user avatar
3 votes
1 answer
65 views

Can we define ink_e2e tests outside of contracts module?

devs. I am writing the e2e tests for my smart contracts using ink_e2e In contracts, I define the e2e-tests like this. #[openbrush::contract] pub mod controller { ... #[cfg(all(test, ...
Wolf's user avatar
  • 61
5 votes
1 answer
61 views

__construct_runtime_integrity_test fails after upgrading to polkadot 0.9.38

After upgrading our chain to polkadot version 0.9.38 and run SKIP_WASM_BUILD= cargo test --all I get the following test error '__construct_runtime_integrity_test::runtime_integrity_tests' panicked at ...
chexware's user avatar
  • 325
4 votes
1 answer
50 views

How to stub ink! contract environment to produce fake values for use in tests?

In an ink! contract I need to use Self.env().block_number() to get the current block number to compare it with a block_number_guessed value that I provide when instantiating the contract and check ...
Luke Schoen's user avatar
  • 2,332
3 votes
1 answer
40 views

A function returning Result::Error will not revert the execution

I used the example Flipper, and changed the code like this: #[ink(message)] pub fn flip(&mut self) -> Result<(), Error> { self.value = !self.value; return ...
george huang's user avatar
5 votes
1 answer
34 views

The package `` depends on `ink_env`, with features: `ink-experimental-engine` but `ink_env` does not have these features

I want to write tests and found the question that potentially soles my problem, but made exactly all what is recommended but still have the same issue. I have added on top of my module with tests ...
Tomasz Waszczyk's user avatar
3 votes
1 answer
46 views

No caller has been set

I write tests for my smart contract and got this error: no caller has been set The error comes from: ink_engine-4.2.0/src/ext.rs:325:14. In function that I want to write tests I have following line: ...
Tomasz Waszczyk's user avatar
4 votes
1 answer
62 views

How we can do the integration testing of a substrate project?

How we can do the integration testing of the substrate application?
Pankaj's user avatar
  • 2,021
5 votes
1 answer
114 views

Why is the AccountId of a contract always 1 when unit testing?

I've been building unit tests in ink and have come across a strange issue. If I instantiate a contract multiple times, the account id is always the same. I thought the account id is the address of the ...
goastler's user avatar
  • 569
3 votes
1 answer
56 views

How to obtain code_hash, contract address, etc, when unit testing an ink smart contract?

I've been unit testing an ink smart contract by calling the constructor and testing various methods on the smart contract. However, I now need to obtain the account of the contract in order to set its ...
goastler's user avatar
  • 569
1 vote
1 answer
59 views

How to stub win.injectedWeb3 for testing dApp with Cypress?

I'm looking for guidance on how to best stub the win.injectedWeb3 object that's usually created by Polkadot{.js}. This is so that I can write some automated tests for a dApp frontend in Cypress w/ ...
Andrew's user avatar
  • 11
3 votes
0 answers
82 views

Steps to import a parachain running in a production environment to test environment?

I am using export-state to copy a parachain running in production environment to development with all the configuration and blocks data. I am following these steps. Can any one please review the steps,...
Syed Kamran's user avatar
1 vote
1 answer
61 views

How to use the follow-chain subcommand in try-runtime?

In the try-runtime documentation, there is note of a follow-chain subcommand which follows the given chain’s finalized blocks and apply all of its extrinsics. There are also some examples here. I ...
Bruno's user avatar
  • 8,365
2 votes
4 answers
107 views

ink-e2e: Metadata artifacts not generated when importing crate

Context: I am trying to detach end-to-end tests from my main contract lib.rs. I created a new module in tests_e2e.rs. I import the module in main contract like so: lib.rs...vvv #[cfg(all(test, feature ...
blairmunroakusa's user avatar
1 vote
1 answer
47 views

How to run "paras" extrinsics on local setups

I would like to test a few scenarios about relaychain council / sudo can update our parachain code in case of emergency. I searched over the web, and try to use "paras" module to do such, ...
Gonzalo Cerro's user avatar
0 votes
2 answers
40 views

How to access StorageValue without getter function in tests?

I have the following StorageValue: #[pallet::storage] #[pallet::getter(fn something)] pub type Something<T> = StorageValue<_, u32>; With the getter function I can access it like this in ...
Bruno's user avatar
  • 8,365
0 votes
0 answers
28 views

What is the account code in genesis account?

What does account code use for? No idea why are 0xff (INVALID) and 0x00 (STOP)... https://github.com/paritytech/frontier/blob/08dfe8986e3f92ce213244c438eb9178653fce59/primitives/evm/src/lib.rs#L87 ...
wcl's user avatar
  • 41
2 votes
0 answers
83 views

Fuzzing Polkadot produces Invalid Signature after chaos is injected

I'm using Polkadot version 0.9.37-08b1c09ca46, across 4 Nodes - Alice, Bob, Charlie, Dave, in a local testnet environment. I have a period of network chaos applied, and then moments of stabilized '...
David Searle's user avatar
0 votes
1 answer
29 views

construct_runtime macro panics in a mock environment while it builds in normal runtime [closed]

Trying to create a mock environment for testing a pallet, but getting an error msg failed to resolve: could not find tt_error_token in the crate root whenever trying to add my pallet in the mock ...
Nakul Amate's user avatar
0 votes
1 answer
73 views

How do I create Hash in tests?

I have a function that creates hash from AccountId's. #[pallet::call_index(2)] #[pallet::weight(10_000 + T::DbWeight::get().writes(1).ref_time())] pub fn connection_request(origin: OriginFor<T>, ...
Burak's user avatar
  • 903
0 votes
1 answer
41 views

How is it possible to avoid a mock runtime and use the actual runtime for testing?

I would like to avoid the most pallet config initialisation and just want to use the actual runtime configuration for the (unit) tests. This would simplify my mock process a lot. The only thing that ...
Chralt's user avatar
  • 543
1 vote
1 answer
87 views

Integration tests for custom pallets

There is a very nice and structured way of writing unit test against a pallet. One can find a lot of examples of unit tests as well. I will be thankful if any one can point me to some resources/...
Syed Kamran's user avatar
2 votes
2 answers
138 views

Polkadot - tests fail out-of-the-box

How can I make the tests pass? Steps to reproduce: git clone https://github.com/paritytech/polkadot cd polkadot cargo build cargo test $ cargo test ⚡ Found 3 strongly connected components which ...
amab8901's user avatar
2 votes
2 answers
349 views

Computer crashing on `cargo test`

I use archlinux on x64_64 CPU architecture. Steps to reproduce: git clone https://github.com/paritytech/substrate cd substrate cargo test it runs up until 1600/1706. And I did it carefully with ...
amab8901's user avatar
1 vote
1 answer
51 views

how to test for storage leaks in pallets

Storage leaks in runtimes can be very damaging and cleaning up with a runtime update migration is non-trivial. I'd like to ensure the absence of storage leaks already in unit testing. My strategy ...
brenzi's user avatar
  • 563
1 vote
1 answer
61 views

Best way to automate extrinsic submissions for testing

I am developing a chain in substrate, and am trying to find the best way to run integration tests against certain sets of extrinsic submissions when the network is running in development mode. It's ...
Nate Armstrong's user avatar
5 votes
1 answer
246 views

construct_runtime_integrity_test failing

After bumping my substrate branch to 0.9.31 along some other changes, I came across a test case failure which I have a hard time getting to the bottom of. The node compiles and runs just fine after ...
Mathis Wellmann's user avatar
0 votes
1 answer
38 views

How to set Alice as author in the mock.rs for testing?

I want to test my pallet that get digest info to collect the author of the current block. So, is it possible to set, for example, Alice as a block author in the mock.rs so I can test it? I set up the ...
viac92's user avatar
  • 107
1 vote
1 answer
30 views

How do you hide test accounts when they are not endowed?

Our chain spec does not endow any of the test accounts yet we are still seeing them shown (with zero balances) in the Polkadot UI. How do we hide them?
vadersfather's user avatar