Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 0 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,73 +47,3 @@ cargo run --bin gol -- create-puzzles

bash -e -x <(linera extract-script-from-markdown backend/README.md)
```

## Testing scores against the production app

Run the commands below using `bash -e -x <(linera extract-script-from-markdown README.md)`.

```bash
# Production app
APP_ID=750eb4b947761eeece6c52fd488ec23442dce240fab150b93ea2212b014aaace

# Scoring chains
CHAIN_0=1b2a5089b0b8cd0971aca985f1819ebb2f23088aca5f864cc99a2666585226ad
CHAIN_1=f30e18278e8cf01ff39d44b856782805b5b22ca5c5dec19ca4694a724cdbf1cd
CHAIN_2=7cc367a5baebdb26f82c4d1753736319cb9bfe1aa920d6a894e93bfc597e2377
CHAIN_3=e3747adab559105a41e361bc52c141a284b31bc5eb0ef738f37c4f3f8651cb39

# Test user and its pinned scoring chain
MATHIEU_CLI="0x359C1a2203aE35adBFA85bC9C1EAB540bF8797a7"
# 2 == 0x359C1a220 % 4
CHAIN=$CHAIN_2

# Getting a chain and tracking the scores
FAUCET_URL=https://faucet.testnet-conway.linera.net

LINERA_TMP_DIR=$(mktemp -d)
export LINERA_WALLET="$LINERA_TMP_DIR/wallet.json"
export LINERA_KEYSTORE="$LINERA_TMP_DIR/keystore.json"
export LINERA_STORAGE="rocksdb:$LINERA_TMP_DIR/client.db"

linera wallet init --faucet $FAUCET_URL
linera wallet follow-chain $CHAIN

linera service --port 8080 &
```

```gql,uri=http://localhost:8080/chains/$CHAIN/applications/$APP_ID
query {
reportedSolutions {
entry(key: "$MATHIEU_CLI") {
key
value {
entries(input: {}) {
key
value
}
}
}
}
}
```

## Previous scoring chains

The following chains were used previously and may contain valid scoring information from early users.

```
# APP_ID=750eb4b947761eeece6c52fd488ec23442dce240fab150b93ea2212b014aaace
CHAIN_V3_0=b4b3575bf33fc466b925b250812bb53147e4013d2be1d629efb7acb172d3c97b
CHAIN_V3_1=ad6dbf944468255c573b4ad36daddbfe03c2de255c471cf8a0bca74e6c044ffd
CHAIN_V3_2=35e0742d9f2171abd0758a334d3f3dbbe2c97567f5d455f0c4fca64a7c6ea3d3
CHAIN_V3_3=0325662e35fb81d180b532af3083c303878ac60d63d850229c5eddc535dfbb9d

# APP_ID=750eb4b947761eeece6c52fd488ec23442dce240fab150b93ea2212b014aaace
CHAIN_V2_0=74b5850ecf6a7389523f7a9748dc6f81fc71533757f617b65e5c9f01fa1430b8
CHAIN_V2_1=3e6bdd095d2e4e30f12e8da38ea1409f2442696b01badbda4226577df09479ff
CHAIN_V2_2=78bfe088e0e6ab2acbb894c7bac4b537650a98ca7337667cef38359b6c590508
CHAIN_V2_3=d6e2e25987b75a51f9ac1df8851bd0e0d16d858e7e2896b1e9d511bac8e13f92

# /!\ APP_ID=27145fa604adf9996647a9a2add1dafe8f80f1a547835edf62ee408cd8903dd3
CHAIN_V1=e71636fde3a70cdbfdb7fd9bef6cb1ba632af8b0567b8f76df47b35489972dd3
```
7 changes: 0 additions & 7 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
content="frame-src https://app.dynamicauth.com 'self';"
/>
<script src="/js/dynamic-iframe-shim.js"></script>
<script type="importmap">
{
"imports": {
"@linera/client": "/node_modules/@linera/client/dist/linera_web.js"
}
}
</script>
</head>
<body>
<div id="root"></div>
Expand Down
3 changes: 1 addition & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
"@heroui/system": "2.4.20",
"@heroui/tabs": "^2.2.21",
"@heroui/theme": "2.4.20",
"@linera/client": "0.15.5",
"@linera/signer": "0.15.5",
"@linera/client": "0.15.7",
"@react-aria/ssr": "3.9.10",
"@react-aria/visually-hidden": "3.8.26",
"@tailwindcss/postcss": "4.1.11",
Expand Down
7 changes: 1 addition & 6 deletions frontend/src/lib/linera/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
export const LINERA_RPC_URL = "https://faucet.testnet-conway.linera.net/";

// Game of Life scoring chain IDs
export const GOL_SCORING_CHAIN_IDS = [
"1b2a5089b0b8cd0971aca985f1819ebb2f23088aca5f864cc99a2666585226ad",
"f30e18278e8cf01ff39d44b856782805b5b22ca5c5dec19ca4694a724cdbf1cd",
"7cc367a5baebdb26f82c4d1753736319cb9bfe1aa920d6a894e93bfc597e2377",
"e3747adab559105a41e361bc52c141a284b31bc5eb0ef738f37c4f3f8651cb39",
]
export const GOL_SCORING_CHAIN_IDS = []

// Game of Life application ID
export const GOL_APP_ID = "750eb4b947761eeece6c52fd488ec23442dce240fab150b93ea2212b014aaace";
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/lib/linera/lib/linera-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import initLinera, { Faucet, Client, Wallet, Application } from "@linera/client";
import { initialize, Faucet, Client, Wallet, Application } from "@linera/client";
import type { Wallet as DynamicWallet } from "@dynamic-labs/sdk-react-core";
import { DynamicSigner } from "./dynamic-signer";

Expand Down Expand Up @@ -41,7 +41,7 @@ export class LineraAdapter {
console.log("🔗 Connecting with Dynamic wallet:", address);

try {
if (!this.wasmInitPromise) this.wasmInitPromise = initLinera();
if (!this.wasmInitPromise) this.wasmInitPromise = initialize();
await this.wasmInitPromise;
console.log("✅ Linera WASM modules initialized successfully");
} catch (e) {
Expand Down Expand Up @@ -105,15 +105,15 @@ export class LineraAdapter {
async setApplications(appId: string, previousAppIds: string[]) {
if (!this.provider) throw new Error("Not connected to Linera");

const application = await this.provider.client.frontend().application(appId);
const application = await this.provider.client.application(appId);

if (!application) throw new Error("Failed to get application");
this.application = application;
console.log("✅ Linera application set successfully: ", appId);

const applications = []
for (const appId of previousAppIds) {
const application = await this.provider.client.frontend().application(appId);
const application = await this.provider.client.application(appId);
if (!application) throw new Error("Failed to get previous application");
applications.push(application);
}
Expand Down
15 changes: 9 additions & 6 deletions frontend/src/lib/linera/services/LineraService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
export interface WalletInfo {
chainId: string;
createdAt: string;
scoringChainId: string;
scoringChainId: string | null;
}

export class LineraService {
Expand Down Expand Up @@ -50,10 +50,13 @@ export class LineraService {

await lineraAdapter.setApplications(GOL_APP_ID, PREVIOUS_GOL_APP_IDS);

const address = lineraAdapter.getAddress();
const value = Number(address.substring(0, 10)); // top 8 hex digits including 0x
const index = value % GOL_SCORING_CHAIN_IDS.length;
const scoringChainId = GOL_SCORING_CHAIN_IDS[index];
var scoringChainId = null;
if (GOL_SCORING_CHAIN_IDS.length > 0) {
const address = lineraAdapter.getAddress();
const value = Number(address.substring(0, 10)); // top 8 hex digits including 0x
const index = value % GOL_SCORING_CHAIN_IDS.length;
scoringChainId = GOL_SCORING_CHAIN_IDS[index];
}

this.walletInfo = {
chainId: provider.chainId,
Expand Down Expand Up @@ -164,7 +167,7 @@ export class LineraService {
try {
const mutation = {
query: `
mutation SubmitSolution($puzzleId: String!, $board: BoardInput!, $scoringChainId: String!) {
mutation SubmitSolution($puzzleId: String!, $board: BoardInput!, $scoringChainId: String) {
submitSolution(puzzleId: $puzzleId, board: $board, scoringChainId: $scoringChainId)
}
`,
Expand Down
Loading