Closed tpmccallum closed 5 years ago
The following is the output from the rustc --explain E0309
command
// This won't compile because T is not constrained, meaning the data
// stored in it is not guaranteed to last as long as the reference
struct Foo<'a, T> {
foo: &'a T
}
This will compile, because it has the constraint on the type parameter:
struct Foo<'a, T: 'a> {
foo: &'a T
}
To see why this is important, consider the case where T
is itself a reference
(e.g., T = &str
). If we don't include the restriction that T: 'a
, the
following code would be perfectly legal:
struct Foo<'a, T> {
foo: &'a T
}
fn main() {
let v = "42".to_string();
let f = Foo{foo: &v};
drop(v);
println!("{}", f.foo); // but we've already dropped v!
}
Could it be that you have an older Rust version? I think we require Rust 1.32 now.
The following command will tell you the version you have. If it's too old, try updating it with rustup.
rustc --version
Thank you @Jannis I was using Rust 1.30 so I did the following to rectify (using Ubuntu 16.04)
# Remove old version
sudo apt remove rustc
# Install new version
curl https://sh.rustup.rs/ -sSf | sh
I once I had done this the cargo, rustc and rustup commands became available at the following file path
/home/ubuntu/.cargo/bin/cargo build
I have moved on to the next step ; step 7.
Now create the subgraph locally on The Graph Node with yarn create-subgraph. On The Graph Hosted service, creating the subgraph is done in the web broswer.
If I run the following command
yarn create-subgraph
in the uniswap-subgraph directory I get the following error
ubuntu@ip-1-2-3-4:/media/nvme/uniswap-subgraph$ yarn create-subgraph
yarn run v1.13.0
$ graph create uniswap-subgraph --node http://127.0.0.1:8020
Could not get access token from libsecret (usually gnome-keyring or ksecretservice): Cannot autolaunch D-Bus without X11 $DISPLAY
Continuing without an access token
Creating subgraph in Graph node: http://127.0.0.1:8020/
HTTP error creating the subgraph: ECONNREFUSED
Solution for the above ^^^
I went ahead and created the following new server.js file inside the uniswap-subgraph directory, and then executed npm start followed by yarn create-subgraph.
var http = require('http');
http.createServer(function(request, response) {
request.pipe(response);
}).listen(8020, '127.0.0.1');
console.log('Listening on port 8020...');
This seemed to allow for the subgraph to be created.
ubuntu@ip-172-31-12-226:/media/nvme/uniswap-subgraph$ yarn create-subgraph
yarn run v1.13.0
$ graph create uniswap-subgraph --node http://127.0.0.1:8020
Could not get access token from libsecret (usually gnome-keyring or ksecretservice): Cannot autolaunch D-Bus without X11 $DISPLAY
Continuing without an access token
Creating subgraph in Graph node: http://127.0.0.1:8020/
Created subgraph: uniswap-subgraph
Done in 0.90s.
Solution to the above ^^^
I went ahead and ran yarn upgrade and we have moved past the above error.
yarn upgrade
I now get the following message when running
yarn --verbose deploy --verbosity debug
Short error message
Failed to compile subgraph Failed to upload subgraph to IPFS
Unexpected token p in JSON at position 4
at Compiler.uploadSubgraphToIPFS (/media/nvme/uniswap-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler.js:307:13)
Full error message
4/4 Upload subgraph to IPFS
Add file to IPFS: dist/schema.graphql
Failed to compile subgraph Failed to upload subgraph to IPFS: Error: Failed to upload file to IPFS: SyntaxError: Unexpected token p in JSON at position 4
at Compiler.uploadSubgraphToIPFS (/media/nvme/uniswap-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler.js:307:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
verbose 1.691 Error: Command failed with exit code 1.
at MessageError.ExtendableBuiltin (/usr/share/yarn/lib/cli.js:727:66)
at new MessageError (/usr/share/yarn/lib/cli.js:756:123)
at /usr/share/yarn/lib/cli.js:36910:15
at Generator.throw (<anonymous>)
at step (/usr/share/yarn/lib/cli.js:304:30)
at /usr/share/yarn/lib/cli.js:317:13
at process._tickCallback (internal/process/next_tick.js:68:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Just FYI, I independently uploaded a file to IPFS using the command line.
# Create file
echo "This is a new file" >> test_ipfs.txt
# Upload file
ipfs add -r test_ipfs.txt
added QmNZU5xtoEaHKiaJaDCWkTy3QB6pH6QdKHxZYCxLWmwk9R test_ipfs.txt
19 B / 19 B [========================================] 100.00%
Check that the file exists
https://ipfs.io/ipfs/QmNZU5xtoEaHKiaJaDCWkTy3QB6pH6QdKHxZYCxLWmwk9R
I started digging a bit deeper and traced the problem back the the "options" argument which is passed into the "Constructor" in the compiler.js file. Options is undefined :(
vi /media/nvme/uniswap-subgraph/node_modules/@graphprotocol/graph-cli/src/compiler.js
Logging the "options" looks like this
class Compiler {
constructor(options) {
this.options = options
this.logger.note('Options are: ', JSON.stringify(options));
Results in the following message
TypeError: Cannot read property 'note' of undefined
From what I can see, the ./node_modules/@graphprotocol/graph-ts/tsconfig.json file extends the tsconfig.assembly.json file (as shown below).
{
"extends": "./node_modules/assemblyscript/tsconfig.assembly.json",
"include": ["index.ts"]
}
However the ./node_modules/assemblyscript/tsconfig.assembly.json file does not actually exist. I believe that this might be why the constructor options are undefined.
I can only see this file name once in the GitHub repo. Could this be part of the issue? https://github.com/graphprotocol/uniswap-subgraph/search?q=tsconfig&unscoped_q=tsconfig
What was the fix to this issue @davekaj?
I dont think we ever solved it, and i closed it because the development of the uniswap subgraph is now in control of the uniswap team https://github.com/Uniswap/uniswap-v2-subgraph . i think it is likely that their subgraph should work when deployed!
https://github.com/Uniswap/uniswap-v3-subgraph worth looking at uniswap v3 as well
Everything worked up until point 6 < https://github.com/graphprotocol/uniswap-subgraph#steps-to-get-the-uniswap-subgraph-running >
Any thoughts on this error?
Many thanks Tim