I'm trying to deploy a simple Solidity contract using Remix, but I'm encountering an error related to missing trie nodes. Here is my contract code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;
contract sample{
function fCalldata(uint[] calldata _x) public pure returns (uint[] calldata){
// 参数为 calldata 数组,不能被修改
// _x[0] = 0;
return(_x);
}
uint[] x = [1,2,3]; // 状态变量,数组 x
function fStorage() public {
// 声明一个 storage 的变量,指向 x。修改xStorage 也会影响 x
uint[] storage xStorage = x;
xStorage[0] = 100;
}
}
When I try to deploy this contract on Remix, I receive the following error:
creation of sample errored: Error occurred: processing response error (body="{"jsonrpc":"2.0","id":74,"error":{"code":-32000,"message":"missing trie node c91d4ecd59dce3067d340b3aadfc0542974b4fb4db98af39f980a91ea00db9dc (path ) state 0xc91d4ecd59dce3067d340b3aadfc0542974b4fb4db98af39f980a91ea00db9dc is not available, not found"}}\n", error={"code":-32000}, requestBody="{"method":"eth_getStorageAt","params":["0xb2a5a8a976688097483a68cdd2f534c6bb0351ac","0x0000000000000000000000000000000000000000000000000000000000000000","0x1"],"id":74,"jsonrpc":"2.0"}", requestMethod="POST", url="https://go.getblock.io/ee42d0a88f314707be11dd799b122cb9", code=SERVER_ERROR, version=web/5.7.1). processing response error (body="{"jsonrpc":"2.0","id":74,"error":{"code":-32000,"message":"missing trie node c91d4ecd59dce3067d340b3aadfc0542974b4fb4db98af39f980a91ea00db9dc (path ) state 0xc91d4ecd59dce3067d340b3aadfc0542974b4fb4db98af39f980a91ea00db9dc is not available, not found"}}\n", error={"code":-32000}, requestBody="{"method":"eth_getStorageAt","params":["0xb2a5a8a976688097483a68cdd2f534c6bb0351ac","0x0000000000000000000000000000000000000000000000000000000000000000","0x1"],"id":74,"jsonrpc":"2.0"}", requestMethod="POST", url="https://go.getblock.io/ee42d0a88f314707be11dd799b122cb9", code=SERVER_ERROR, version=web/5.7.1) You may want to cautiously increase the gas limit if the transaction went out of gas.
No matter how I raise gas limit. enter image description here
However, when I remove the following part of the code, the contract deploys successfully:
uint[] x = [1,2,3]; // 状态变量,数组 x
function fStorage() public {
// 声明一个 storage 的变量,指向 x。修改xStorage 也会影响 x
uint[] storage xStorage = x;
xStorage[0] = 100;
}
Thanks in advance for your help!
It turns out it wasn't related to the code at all but was an issue with the Chrome browser. When using Remix VM (Cancun), the accounts weren't displaying. However, switching to a different browser, like Microsoft Edge, resolved the issue, and the accounts now display correctly.
So if anyone else encounters this problem, try using a different browser to see if that fixes it. Thanks for all the suggestions!