-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/initial mixnet contract #515
Conversation
…l copy/paste for now.
Cargo.toml
Outdated
[profile.release.package.mixnet-contracts] | ||
opt-level = 3 | ||
debug = false | ||
#rpath = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess those are requirements to compile the wasm contracts, but what's the point of leaving commented fields?
cd nymd | ||
git checkout v0.14.1 | ||
go build -o nymd -mod=readonly -tags "netgo,ledger" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=nymd -X github.com/cosmos/cosmos-sdk/version.AppName=nymd -X github.com/CosmWasm/wasmd/app.NodeDir=.nymd -X github.com/cosmos/cosmos-sdk/version.Version=0.14.1 -X github.com/cosmos/cosmos-sdk/version.Commit=1920f80d181adbeaedac1eeea1c1c6e1704d3e49 -X github.com/CosmWasm/wasmd/app.Bech32Prefix=nym -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger"' -trimpath ./cmd/wasmd | ||
mv nymd $GOBIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you follow official Go installation guide, $GOBIN
is not getting set (and neither it is set in go env GOBIN
(unless I missed something)), perhaps this step should be removed or changed to just say "move the binary to somewhere within your $PATH"? I think this might be less confusing for people
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to write real docs for this, so far this is just in note-to-self form. I expect at the moment that these docs are you and me level, the real docs writing will take place later on the docs site (and these ones will come out).
Init the blockchain running with: | ||
|
||
``` | ||
./init.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason this gave me an error:
./init.sh: line 22: python: command not found
even though I do have python installed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see, when I run the set_contract_upload_permissions.py
manually it gave the following error:
Traceback (most recent call last):
File "set_contract_upload_permissions.py", line 14, in <module>
genesis_file = open(genesis_filename, "r")
FileNotFoundError: [Errno 2] No such file or directory: '/home/dave/.nymd/config/genesis.json'
I think it should grab user's home directory rather than use yours : )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, even after "fixing" the .py
file, the first error is still present when running init.sh
- not sure why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is still in quite early form, not ready for release.
``` | ||
cd nym-driver-example | ||
npm install | ||
npx nodemon --exec ts-node ./index.ts --watch . --ext .ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It crashed when trying to run this:
npx nodemon --exec ts-node ./index.ts --watch . --ext .ts
[nodemon] 2.0.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: ts
[nodemon] starting `ts-node ./index.ts`
/home/jedrzej/workspace/nym/clients/validator/examples/nym-driver-example/node_modules/ts-node/src/index.ts:513
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
index.ts:1:29 - error TS2307: Cannot find module 'nym-validator-client' or its corresponding type declarations.
1 import ValidatorClient from "nym-validator-client";
~~~~~~~~~~~~~~~~~~~~~~
index.ts:3:25 - error TS2307: Cannot find module '../../dist/types' or its corresponding type declarations.
3 import { MixNode } from "../../dist/types";
~~~~~~~~~~~~~~~~~~
at createTSError (/home/jedrzej/workspace/nym/clients/validator/examples/nym-driver-example/node_modules/ts-node/src/index.ts:513:12)
at reportTSError (/home/jedrzej/workspace/nym/clients/validator/examples/nym-driver-example/node_modules/ts-node/src/index.ts:517:19)
at getOutput (/home/jedrzej/workspace/nym/clients/validator/examples/nym-driver-example/node_modules/ts-node/src/index.ts:752:36)
at Object.compile (/home/jedrzej/workspace/nym/clients/validator/examples/nym-driver-example/node_modules/ts-node/src/index.ts:968:32)
at Module.m._compile (/home/jedrzej/workspace/nym/clients/validator/examples/nym-driver-example/node_modules/ts-node/src/index.ts:1056:42)
at Module._extensions..js (node:internal/modules/cjs/loader:1120:10)
at Object.require.extensions.<computed> [as .ts] (/home/jedrzej/workspace/nym/clients/validator/examples/nym-driver-example/node_modules/ts-node/src/index.ts:1059:12)
at Module.load (node:internal/modules/cjs/loader:971:32)
at Function.Module._load (node:internal/modules/cjs/loader:812:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
[nodemon] app crashed - waiting for file changes before starting...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Did you npm install
and npm run build
first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I run npm install
as per instruction, but didn't do npm run build
. I just run it now and it returned an error:
❯ npm run build
> nym-driver-example@1.0.0 build
> tsc
index.ts:1:29 - error TS2307: Cannot find module 'nym-validator-client' or its corresponding type declarations.
1 import ValidatorClient from "nym-validator-client";
~~~~~~~~~~~~~~~~~~~~~~
index.ts:3:25 - error TS2307: Cannot find module '../../dist/types' or its corresponding type declarations.
3 import { MixNode } from "../../dist/types";
~~~~~~~~~~~~~~~~~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok let's work this one out in video chat. Grab me when you're around :).
|
||
export type MixNodeBond = { // TODO: change name to MixNodeBond | ||
owner: string, | ||
mix_node: MixNode, // TODO: camelCase this later once everything else works |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so does everything else work now?
|
||
await cache.refreshMixNodes(contractAddress); // should make multiple paginated requests because there are two pages in the response fixture | ||
await cache.refreshMixNodes(contractAddress); | ||
// mockClient.verify(netClient => netClient.getMixNodes(contractAddress, perPage, undefined), Times.Exactly(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for leaving those out?
bech32prefix: "nym", | ||
}; | ||
|
||
// const connect = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this bit?
clients/validator/src/net-client.ts
Outdated
@@ -0,0 +1,102 @@ | |||
import { SigningCosmWasmClient, SigningCosmWasmClientOptions } from '@cosmjs/cosmwasm-stargate'; | |||
import { MixNodeBond } from './types' | |||
// import { connect as connectHelper } from "./stargate-helper"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? : )
/// otherwise returns false. | ||
shouldMakeAnotherRequest(response: PagedResponse): boolean { | ||
let next = response.start_next_after; | ||
let nextExists: boolean = (next != null && next != undefined && next != ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I've learned after my disgusting adventure through javascript is that you should almost always use the stricter triple equals, i.e. next !== null
rather than next != null
@@ -25,3 +25,4 @@ v6-topology.json | |||
/explorer/downloads/topology.json | |||
/explorer/public/downloads/mixmining.json | |||
/explorer/public/downloads/topology.json | |||
/clients/validator/examples/nym-driver-example/current-contract.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this magic text file we're ignoring now? (just curious)
No description provided.