Skip to content

Conversation

@jmtth
Copy link
Collaborator

@jmtth jmtth commented Jan 20, 2026

Little Pull request

Changes:

1 - deploy on fuji
2 - update Dapp
3 - Clean route to Dapp /blockchain

jmtth and others added 3 commits January 20, 2026 08:12
fix(block): ubpdate some static file lonks
feat(block): add background of front in Dapp

srcs/.env.blockchain.example
srcs/blockchain/.env.test.blockchain
srcs/blockchain/src/SmartContract/hardhat.config.ts
srcs/blockchain/src/config/env.ts
srcs/blockchain/src/core/error.ts
srcs/blockchain/src/module/block.consumers.ts
srcs/blockchain/src/public/bg.svg
srcs/blockchain/src/public/output.css
srcs/blockchain/src/public/style-block.css
srcs/blockchain/src/views/header.ejs
srcs/blockchain/src/views/index.ejs
srcs/blockchain/src/views/snapshot-details.ejs
srcs/blockchain/src/views/snapshots.ejs
package-lock.json
srcs/blockchain/.env.test.blockchain
srcs/blockchain/src/SmartContract/hardhat.config.ts
srcs/blockchain/src/SmartContract/ignition/deployments/chain-43113/journal.jsonl
srcs/blockchain/src/SmartContract/package-lock.json
srcs/blockchain/src/public/output.css
srcs/blockchain/src/views/index.ejs
srcs/blockchain/src/views/snapshot-details.ejs
srcs/blockchain/src/views/snapshots.ejs
srcs/gateway/src/controllers/block.controller.ts
srcs/nginx/conf.d/default.conf
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR configures deployment to the Avalanche Fuji testnet and updates the blockchain DApp with routing corrections and UI improvements.

Changes:

  • Deploys smart contract to Fuji testnet and updates RPC URL configuration
  • Fixes blockchain DApp URL paths to consistently use /blockchain prefix
  • Adds visual styling improvements (opacity, background image)
  • Cleans up nginx routing configuration and gateway controller formatting

Reviewed changes

Copilot reviewed 18 out of 21 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
srcs/nginx/conf.d/default.conf Commented out /blockchain redirect (potential issue)
srcs/gateway/src/controllers/block.controller.ts Added semicolons for consistency
srcs/blockchain/src/views/*.ejs Fixed URLs to include /blockchain prefix, added opacity styling
srcs/blockchain/src/views/header.ejs Added background image
srcs/blockchain/src/public/* Updated CSS and added background SVG
srcs/blockchain/src/config/env.ts Changed RPC URL from localhost to Fuji testnet
srcs/blockchain/src/SmartContract/hardhat.config.ts Added Fuji network configuration
srcs/blockchain/.env.test.blockchain Updated with Fuji testnet settings including private key
srcs/blockchain/src/SmartContract/ignition/deployments/chain-43113/* Generated deployment artifacts from Fuji deployment
package-lock.json Dependency metadata updates
Files not reviewed (1)
  • srcs/blockchain/src/SmartContract/package-lock.json: Language not supported

#LOCALHOST_RPC_URL=http://localhost:8545
AVALANCHE_RPC_URL=https://api.avax-test.network/ext/bc/C/rpc
GAME_STORAGE_ADDRESS=0x3Dc80ABf698428eb01585b859182835aD1cf4943
BLOCKCHAIN_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file .env.test.blockchain contains a hardcoded private key. While this appears to be a well-known test private key (Hardhat's default), committing any private key to version control is a security risk. Even test keys can be dangerous if accidentally used in production or if they contain any value.

Consider:

  1. Remove this file from version control
  2. Add it to .gitignore
  3. Provide a template file instead (e.g., .env.test.blockchain.example) with placeholder values
Suggested change
BLOCKCHAIN_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
#BLOCKCHAIN_PRIVATE_KEY=<set_your_local_test_private_key_here>

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem because it is Hardhat keys

Comment on lines +16 to +17
url: env.AVALANCHE_RPC_URL,
accounts: [configVariable('BLOCKCHAIN_PRIVATE_KEY')],
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardhat configuration is importing environment variables from ../config/env.js but then also using configVariable('BLOCKCHAIN_PRIVATE_KEY') which is Hardhat's way of reading from configuration variables.

This creates confusion about where configuration comes from. The env.AVALANCHE_RPC_URL reads from your custom env module, but configVariable('BLOCKCHAIN_PRIVATE_KEY') reads from Hardhat's configuration system (typically via hardhat.config variables or environment).

Consider standardizing the configuration approach:

  • Either use env.BLOCKCHAIN_PRIVATE_KEY for consistency with the RPC URL
  • Or use configVariable() for both values
  • Document clearly in your project which configuration method is being used

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env.AVALANCHE_RPC_URL is public and BLOCKCHAIN_PRIVATE_KEY is private so it is ok

Comment on lines +1 to +37
{
"_format": "hh3-sol-build-info-1",
"id": "solc-0_8_28-182c07f09ddae47ddc6468aadf3314b5199ffd2a",
"solcVersion": "0.8.28",
"solcLongVersion": "0.8.28+commit.7893614a",
"userSourceNameMap": {
"contracts/GameStorage.sol": "project/contracts/GameStorage.sol"
},
"input": {
"language": "Solidity",
"settings": {
"evmVersion": "cancun",
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"": ["ast"],
"*": ["abi", "evm.bytecode", "evm.deployedBytecode", "evm.methodIdentifiers", "metadata"]
}
},
"remappings": ["project/:@openzeppelin/contracts/=npm/@openzeppelin/contracts@5.4.0/"]
},
"sources": {
"npm/@openzeppelin/contracts@5.4.0/access/Ownable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
},
"npm/@openzeppelin/contracts@5.4.0/utils/Context.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n"
},
"project/contracts/GameStorage.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.28;\n\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract GameStorage is Ownable {\n constructor(address initialOwner) Ownable(initialOwner) {}\n\n struct Tournament {\n uint32 player1;\n uint32 player2;\n uint32 player3;\n uint32 player4;\n uint32 timestamp;\n }\n mapping(uint32 => Tournament) public tournaments;\n uint256[] public tournamentIds;\n mapping(uint32 => bool) public exists;\n\n event TournamentStored(\n uint32 tour_id,\n uint32 player1,\n uint32 player2,\n uint32 player3,\n uint32 player4,\n uint32 ts,\n bytes32 snapshotHash\n );\n\n function storeTournament(uint32 tour_id, uint32 player1, uint32 player2, uint32 player3, uint32 player4) external onlyOwner {\n require(!exists[tour_id], \"Tournament already stored!\");\n uint32 ts = uint32(block.timestamp);\n exists[tour_id] = true;\n tournaments[tour_id] = Tournament(player1, player2, player3, player4, ts);\n bytes32 snapshotHash = keccak256(abi.encode(tour_id, player1, player2, player3, player4, ts));\n emit TournamentStored(tour_id, player1, player2, player3, player4, ts, snapshotHash);\n tournamentIds.push(tour_id); \n }\n\n function getTournament(uint32 tour_id) external view returns (Tournament memory){\n require(exists[tour_id], \"Tournament does not exist!\");\n return tournaments[tour_id];\n }\n \n function getNbTournamentStored() external view returns (uint256){\n return tournamentIds.length;\n }\n}\n"
}
}
}
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated smart contract deployment artifacts (JSON build info, journal, addresses) are being committed to version control. These files are typically large, auto-generated, and can be regenerated from source.

Best practices suggest:

  1. Add srcs/blockchain/src/SmartContract/ignition/deployments/ to .gitignore
  2. Keep deployment addresses in a separate, smaller configuration file if needed for reference
  3. Document deployment addresses in your README or deployment documentation instead

This keeps the repository cleaner and avoids merge conflicts when multiple developers deploy to different networks.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je viens de le rajouter

Comment on lines 129 to 131
# location = /blockchain {
# return 301 /blockchain/;
# }
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out nginx location block for /blockchain redirect was removed, but it's unclear why this redirect was needed originally and whether removing it might break existing bookmarks or links.

If this redirect was handling requests to /blockchain (without trailing slash) to redirect to /blockchain/ (with trailing slash), removing it could cause user-facing issues. The uncommented location /blockchain/ block below will only match paths with the trailing slash.

Consider:

  1. If the redirect was intentionally removed, document why in the commit message
  2. If it was an oversight, restore the redirect to handle both /blockchain and /blockchain/ URLs
  3. Test that accessing /blockchain without a trailing slash works as expected
Suggested change
# location = /blockchain {
# return 301 /blockchain/;
# }
location = /blockchain {
return 301 /blockchain/;
}

Copilot uses AI. Check for mistakes.
}
# location = /blockchain {
# return 301 /blockchain/;
# }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autant la supprimer ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autant le garder car /blockchain et /blockchain/ passe par la meme redirection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants