Questions tagged [test]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
21 views

How to mock out a signed transaction w/ Waffle Mocks?

When applying Waffle mock to simulate a contract method that must be explicity signed an error is thrown: Error: Contract with a Signer cannot override from (operation="overrides.from", code=...
0
votes
0answers
9 views

How to use bn-chai in a typescript test script?

I would like to use bn-chai plugin for chai in a test script written in typescript. I imported (the official documentation uses require) the dependencies and set chai according documentation: import { ...
1
vote
0answers
219 views

Hardhat: InvalidInputError: sender doesn't have enough funds to send tx

I am getting following error: InvalidInputError: sender doesn't have enough funds to send tx. The max upfront cost is: 1720878550726790368 and the sender's account only has: 47925025381294726 I am ...
1
vote
3answers
211 views

How to debug a solidity test

I am using ganache and truffle to write some tests in solidity (following the example in https://www.trufflesuite.com/docs/truffle/testing/writing-tests-in-solidity). I am getting the usual, not ...
0
votes
0answers
8 views

Initialise struct with nested mappings in a truffle test

I am writing a test following the following examples: https://www.trufflesuite.com/docs/truffle/testing/writing-tests-in-solidity In the test I need to define a struct located in the storage. I wrote ...
0
votes
0answers
12 views

My truffle test javascript is logging a big number and I have no idea why

I'm new to truffle test writing. I've written a pretty simple test to make sure it's deployed, but my console log keeps printing the following and I dont know why it would be logging something like ...
0
votes
0answers
42 views

JSON RPC not loading in Docker Container used for CI

I am able to run my tests in my local environment with no issue, however when I push to the remote repo, I get a HH110 error in the docker environment used for running continuous integration. My ...
1
vote
0answers
16 views

Ropstens test net. How do I solve this?

The picture below shows the wallet status of the Ropstens test server. How long do I have to wait to resolve it? How do I solve this? Where should I ask for help? My wallet is not working.
0
votes
2answers
30 views

Remix says that I got undeclared variable in my test contract when trying to run it, when it is declared in the original contract. How to fix?

Basically I need to get the hash from the function in the original contract, and for that the function makeBet() requires some input. The function looks like this: pragma solidity >=0.8.0 <0.9.0;...
0
votes
2answers
953 views

change transaction msg.value and msg.sender on hardhat test

I have a lottery kind of app for which users send money to a contract that at the time pays rewards. Simplified, the method I'm trying to test is something like this: struct Bet { address payable ...
0
votes
1answer
18 views

Should you use call() when you call solidity functions from Javascript tests

Let's say my solidity code is contract MetaCoin { uint256 public balance = 0; function getBalance() public view returns(uint) { return balance } } Let's say I want to call the getBalance ...
2
votes
1answer
234 views

Openzeppelin test helper with hardhat config and tests

I'm using hardhat and I added a task to manipulate time in the hardhat.config.js file which is working fine. require("@nomiclabs/hardhat-waffle"); require("@nomiclabs/hardhat-truffle5&...
0
votes
1answer
101 views

Balance of contract

I am testing a smart contract but I have troubles accessing the balance of the contract in my javascript test file. For simplicity assume this is my smart contract: contract Donation{ function ...
1
vote
0answers
12 views

Is necesary pass a Dapp to mainnet or in testnet is ok for a production smart contract process? [duplicate]

Because the client Dapp propietary don´t have real Ether, only Ropsten test Ether via faucet.ropsten.be/ is necesary buy Real Ether to preserve smart contracts in ethereum or in Ropsten testnetwok is ...
0
votes
1answer
405 views

Verify a signature generated with web3 in solidity

I am trying to verify a signature in solidity, which I generated in my truffle test. I followed this tutorial for implementing the smart contract, but made small adjustions: library Lib { /** ...
0
votes
0answers
42 views

How to make a deployer in truffle tests?

For some reason, our app will only work with a forked instance of the mainnet. And hence, we want to run our test on the forked ganache. We are using truffle, so we have written all of our tests in ...
-1
votes
1answer
454 views

I minted an NFT by mistake while in Rinkeby Test net on my wallet, the NFT sold for 1eth now it’s in my test wallet how do I recover this ETH?

This is the details of the transfer Buyer my1703 Transaction hash 0x5438b317f970448a040bba32b89c1e2c4ae306943764193a19d7e65739ae2283 You earned 1.007224 ETH Type of transaction Purchase Time sent Sun ...
0
votes
1answer
162 views

How can I test my purchase function on the truffle with chai?

I'm trying to test my token buying function but I encounter an error, o facilitate understanding I will show the code "Error: Returned error: VM Exception while processing transaction: revert&...
0
votes
1answer
101 views

I want to understand something with BigNumber assertions

I have create a truffle project with a smartcontract and a test file. Here is an extract of the test file: expect(ret).to.be.bignumber.equal(new BN('42')); ret is a value returned by a smartcontract'...
0
votes
0answers
30 views

Automated tests with brownie - how to handle "base fee exceeds gas limit"

I have wrote this very basic test scenario with brownie: import pytest def test_set_get_18(tcontrat1,accounts): tcontrat1.set(18, {'from': accounts[0],'gas_limit':100}) assert tcontrat1.get() ...
1
vote
0answers
10 views

Problem of VMTest

Recently I implement the EVM, but when I check the test suit of VMTest. I found that if the storage of key and value are both 0x00, the storage is empty in the "post" section after executing ...
0
votes
0answers
133 views

Truffle test doesn't recognize estimateGas function

I'm trying to test my contracts using Truffle and Ganache, but I'm facing some problems with some functions. When I call a non view function, I'm getting the error "out of gas". Moreover, if ...
0
votes
0answers
76 views

Wrong contract balance shown by web3.eth.getBalance

I want to test if the balance updates when I send some eths it("the balance matches the price of a person", async function(){ let instance = await People.deployed() await instance....
0
votes
1answer
72 views

How I can do steps in the truffle test?

I'm testing AMM, so I have steps like add liquidity, try to swap remove liquidity etc I can just add it in one it block like this answer suggests contract('amm', (accounts) => { it ("...
0
votes
0answers
86 views

Truffle "test" is passing only 1 it("") test instead of showing "all 3 tests passed"

MyToken.sol //// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract MyToken is ERC20 { constructor(uint256 ...
0
votes
0answers
266 views

"before each" hook error while run truffle test command

I ran truffle test command on my project for testing but I got an error like this: "before each" hook for "1- should be return true Pauser Role for account[0]" why I'm getting ...
0
votes
1answer
27 views

Time-dependent test unexpected behavior at 1st attempt, expected behavior at 2nd attempt

I'm trying to test a contract in which functions should require certain timestamps. Parts of code are eliminated for readability: Here's the problematic part of the contract : PCE_Contract.sol pragma ...
1
vote
1answer
133 views

How to test abstract contracts using truffle?

Is it possible to test abstract contract using truffle? If yes, how I can to do it?
0
votes
1answer
52 views

Test for Require statement in Truffle

I wrote a function that generate a key value. the function codes is here mapping(string => bool) processedHash; mapping(uint => bool) HashList; function generateHash(uint256 ...
0
votes
0answers
26 views

How to assign event output to variable when testing?

I'm using Truffle test(chai/mocha) and openzeppelin-test-helpers. Can anyone help me about how to assign values from event to variables in the above testing environment?