solana-labs / example-tictactoe Goto Github PK
View Code? Open in Web Editor NEWTic-Tac-Toe built on Solana
Home Page: https://solana-example-tictactoe.herokuapp.com/
License: MIT License
Tic-Tac-Toe built on Solana
Home Page: https://solana-example-tictactoe.herokuapp.com/
License: MIT License
do as your doc said, always failed to do npm run start
. both local docker and live=1 testnet.
await BpfLoader.load(connection, loaderAccount, elf);
not working
Deploys are currently manual but should be triggered off of the master branch
I believe that deploys are manual because the Heroku buildpacks on the TicTacToe Heroku app are not configured to build the Rust program. We can leverage additional heroku buildpacks as we already do in the Message Feed example app
I recently ran the example tictactoe program on the solana net docker image provided.
But it crashes when it starts looking for players in the network.
The BPF program loads successfully and returns the ID as expected.
Connecting to network...
Using http://localhost:8899 (http://localhost:8899)
findDashboard: Expected a value of type `{jsonrpc,id,error} | {jsonrpc,id,error,result}` for `result` but received `{"data":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"executable":false,"lamports":9997,"owner":[65,163,87,159,4,48,133,107,197,231,226,206,66,25,75,160,182,222,93,219,241,140,68,228,38,10,53,247,9,23,154,146],"rent_epoch":3}`.
Using BPF program
Loading BPF program...
Dashboard programId: 2q41KNuLTKRgwU4qhuEyp4ryyWZAsYpBrFWN4TApwXgU
Dashboard: 6sZki97CtDN3GzzURQwSyKhHYgTsKzdoqDPrPCCYP5Yx
Total games played: 0
Looking for another player
/home/siddharth/Solana/example-tictactoe/node_modules/superstruct/lib/index.js:1194
throw new StructError(error);
^
TypeError: Expected a value of type `undefined` for `result.rent_epoch` but received `4`.
at Function.Struct.assert.value [as assert] (/home/siddharth/Solana/example-tictactoe/node_modules/superstruct/src/superstruct.js:63:15)
at Struct (/home/siddharth/Solana/example-tictactoe/node_modules/superstruct/src/superstruct.js:47:21)
at Connection._wsOnAccountNotification (/home/siddharth/Solana/example-tictactoe/node_modules/@solana/web3.js/src/connection.js:879:17)
at Client.emit (/home/siddharth/Solana/example-tictactoe/node_modules/rpc-websockets/node_modules/eventemitter3/index.js:181:35)
at WebSocket.<anonymous> (/home/siddharth/Solana/example-tictactoe/node_modules/rpc-websockets/dist/lib/client.js:424:67)
at WebSocket.emit (events.js:189:13)
at WebSocket.EventEmitter.emit (domain.js:441:20)
at Receiver.receiverOnMessage (/home/siddharth/Solana/example-tictactoe/node_modules/rpc-websockets/node_modules/ws/lib/websocket.js:720:20)
at Receiver.emit (events.js:189:13)
at Receiver.EventEmitter.emit (domain.js:441:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `babel-node src/cli/main.js "dev"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/siddharth/.npm/_logs/2019-09-01T12_46_25_343Z-debug.log
When running npm run start
the program exits after dashboard creation when it should instead be starting a new game or connecting to an existing one.
Looks like the following commit is the issue:
aa8035c
npm run start
should start the tictactoe dashboard and keep it alive until a competitor joins
Keep alive fails to keep the dashboard up
Looking for another player
Advertising our game (ABtm1oa5pyCFRZioWmpGZAyuiUynmdUjFjnr3v1qP5tw)
keepAlive() failed #1: Error: Transaction 5ipfueWMrCdVGs5rK4XzaziKr5zJd9U7fugvNZ8ACGjRE83M7UKc3QJMYSigE4iFshGHnbgzSPRfQrA9Lyf4uVoW failed ({"Err":{"InstructionError":[0,"GenericError"]}})
keepAlive() failed #2: Error: Transaction 4JSW8W98w1dq3ZSAzB31sui9aUi7vY2ah4e95jGY5Ew8AFxXLMVhd2qgqpF7VBAFS1Qmn5gnBepVNG7vvF25BnFM failed ({"Err":{"InstructionError":[0,"GenericError"]}})
keepAlive() failed #3: Error: Transaction 4qe7bdUJ2NBuyCUyUdQ29Yoi5mNHSmjnNiTBHQXNWW8qmXd1oG537h7y6iYHXhoxpaWSQ1NkbEEZbbLQ1VRiRnwc failed ({"Err":{"InstructionError":[0,"GenericError"]}})
keepAlive() failed #4: Error: Transaction 67kGkCLTnCUcmsJ2mJXwh9WFjK4vNUDZymQNhNfM7GiabpCYJCqTFkcPerWKeGFSRcqp2RRJs7sQ6fMkbJxhkgWb failed ({"Err":{"InstructionError":[0,"GenericError"]}})
Error: game disconnected
at TicTacToeDashboard._callee2$ (/Users/starry/Workspace/solana/example-tictactoe/src/program/tic-tac-toe-dashboard.js:222:17)
at tryCatch (/Users/starry/Workspace/solana/example-tictactoe/node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (/Users/starry/Workspace/solana/example-tictactoe/node_modules/regenerator-runtime/runtime.js:296:22)
at Generator.prototype.<computed> [as next] (/Users/starry/Workspace/solana/example-tictactoe/node_modules/regenerator-runtime/runtime.js:114:21)
at step (/Users/starry/Workspace/solana/example-tictactoe/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /Users/starry/Workspace/solana/example-tictactoe/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
[2019-08-05T19:31:04.759005300Z INFO solana_bpf_loader_api::helpers] info!: "tic-tac-toe program entrypoint"
[2019-08-05T19:31:04.759092100Z INFO solana_bpf_loader_api::helpers] info!: 0x5, 0x0, 0x0, 0x0, 0x0
[2019-08-05T19:31:04.759119800Z INFO solana_bpf_loader_api::helpers] info!: "Command_KeepAlive"
[2019-08-05T19:31:04.759137900Z INFO solana_bpf_loader_api::helpers] info!: "Invalid player x keep_alive"
[2019-08-05T19:31:04.759148900Z INFO solana_bpf_loader_api::helpers] info!: 0x0, 0x0, 0x0, 0x0, 0x0
(affects bpf-c only)
Hi guys,
I'm trying to run Tic-Tac-Toe to a local Solana.
When I try to build the BPF C program on macOS Mojave v.10.14.1 and execution failed with following stack:
$ V=1 make -C program-bpf
+ rm -rf 'criterion*'
+ mkdir criterion
+ cd criterion
+ wget --progress=dot:mega https://github.com/Snaipe/Criterion/releases/download/v2.3.2/criterion-v2.3.2-osx-x86_64.tar.bz2
../node_modules/@solana/web3.js/bpf-sdk//scripts/install.sh: line 21: wget: command not found
[test cc] ../dist/program/test_tictactoe (test/tictactoe.c)
mkdir -p ../dist/program
../node_modules/@solana/web3.js/bpf-sdk/llvm-native//bin/clang -Werror -O2 -fno-builtin -std=c17 -isystem../node_modules/@solana/web3.js/bpf-sdk/inc -isystem../node_modules/@solana/web3.js/bpf-sdk/llvm-native//lib/clang/8.0.0/include -DSOL_TEST -isystem ../node_modules/@solana/web3.js/bpf-sdk/criterion/include -L ../node_modules/@solana/web3.js/bpf-sdk/criterion/lib -rpath /Users/vladislavivanov/Projects/Solana/example-tictactoe/node_modules/@solana/web3.js/bpf-sdk/criterion/lib -lcriterion -o ../dist/program/test_tictactoe test/tictactoe.c -MD -MF ../dist/program/test_tictactoe.d
make: ../node_modules/@solana/web3.js/bpf-sdk/llvm-native//bin/clang: No such file or directory
make: *** [../dist/program/test_tictactoe] Error 1
Please, check and the output for starting local Solana:
npx solana-localnet update
Docker version 18.09.0, build 4d60db4
+ docker pull solanalabs/solana:edge
edge: Pulling from solanalabs/solana
05d1a5232b46: Pull complete
5d005cbf2b08: Pull complete
5398c64aa99e: Pull complete
Digest: sha256:c009436c924b6d1220ad36b62d2d07ea65169151523cd4acd9c7c9e01b464f30
Status: Downloaded newer image for solanalabs/solana:edge
Vladislavs-MBP:example-tictactoe vladislavivanov$ npm run localnet:up
> [email protected] localnet:up /Users/vladislavivanov/Projects/Solana/example-tictactoe
> set -x; solana-localnet down; set -e; solana-localnet up
+ solana-localnet down
Docker version 18.09.0, build 4d60db4
+ docker stop --time 0 solana-localnet
Error response from daemon: No such container: solana-localnet
+ set -e
+ solana-localnet up
Docker version 18.09.0, build 4d60db4
+ RUST_LOG=solana=warn,solana_bpf=info,solana_jsonrpc=info,solana::rpc=info,solana_fullnode=info,solana::drone=info,solana::bank=info,solana::banking_stage=info,solana::system_program=info
+ docker run --detach --name solana-localnet --rm --publish 8899:8899 --publish 8900:8900 --tty --env RUST_LOG=solana=warn,solana_bpf=info,solana_jsonrpc=info,solana::rpc=info,solana_fullnode=info,solana::drone=info,solana::bank=info,solana::banking_stage=info,solana::system_program=info solanalabs/solana:edge
a7d6bfdabd73678e26992c990bcd91c5dbf0ca9640868a377c131e41976be835
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
curl: (52) Empty reply from server
+ sleep 1
+ for _ in 1 2 3 4 5
+ curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1, "method":"getTransactionCount"}' http://localhost:8899
{"jsonrpc":"2.0","result":0,"id":1}
+ break
Error response from daemon: No such container: solana-localnet
Any ideas where is my mistake?
Cheers!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.