pourquoi ai je cette erreur " devrait générer des mots aléatoires correctement: Error:…
Jump to turn (6)
- 1pourquoi ai je cette erreur " devrait générer des mots aléatoires correctement:
- 2la fonction qui contient "wordList" " function initWordList() public onlyOwner {
- 3en faisant la modification, j'ai toujours l'erreur : "Error: VM Exception while
- 4j'ai modifié " const randomWords = [2, 4, 9];" l'erreur est toujours là
- 5test de la fonction initWordList fonctionne : " it("devrait accepter les mots si
- 6pourquoi je ne peux pas utliser word ? " uint8 public wordLength; uint256 public
- User
pourquoi ai je cette erreur " devrait générer des mots aléatoires correctement: Error: VM Exception while processing transaction: revert invalid word -- Reason given: invalid word. - const receipt = await penduelInstance.fulfillRandomWordsAndCheck(_requestId, randomWords);" les fonctions " function fulfillRandomWords(uint256 _requestId, uint256[] memory randomWords) internal override { gameId = RequestIds[_requestId]; gameId = getGameId(); for (uint256 i = 0; i < randomWords.length; i++) { require(randomWords[i] < wordList.length, "invalid word"); word = wordList[randomWords[i]]; } } function fulfillRandomWordsAndCheck(uint256 _requestId, uint256[] memory randomWords) public { fulfillRandomWords(_requestId, randomWords); require(randomWords.length > 0, "no random words"); emit RequestId(gameId, _requestId); state = State.wordGenerated; emit WordGenerated(word); }" le test : it("devrait générer des mots aléatoires correctement", async () => { const _requestId = 1; const randomWords = [2, 4, 6]; const receipt = await penduelInstance.fulfillRandomWordsAndCheck(_requestId, randomWords); expectEvent(receipt, "RequestId", { gameId: new BN(gameId), requestId: _requestId }); const gameState = await penduelInstance.state(); assert.equal(gameState, 3, "L'état devrait être wordGenerated"); for (let i = 0; i < randomWords.length; i++) { expectEvent(receipt, "WordGenerated", { word: web3.utils.fromAscii(wordList[randomWords[i]]) }); } });