Skip to content

Releases: peeramid-labs/rankify-contracts

v0.12.4

20 Mar 03:31
4cb3451
Compare
Choose a tag to compare

Patch Changes

v0.12.3

19 Mar 10:04
3dda303
Compare
Choose a tag to compare

Patch Changes

v0.12.2

12 Mar 10:29
6f09ac8
Compare
Choose a tag to compare

Patch Changes

v0.12.1

04 Mar 06:40
3cef253
Compare
Choose a tag to compare

Patch Changes

v0.12.0

22 Feb 01:07
e089050
Compare
Choose a tag to compare

Minor Changes

  • #134 ef0faf485c1b27933fb41deb1c904708e75328f5 Thanks @peersky! - Added metadata field to game properties

  • #110 b7081591a12eccb8a83d22d4975b4062568597c2 Thanks @peersky! - # Changelog

    Major Contract Changes

    Major Features

    • Zero-Knowledge Proof Integration
      Added circuit-based integrity verification system for game state transitions:

      • New proposals_integrity_15.circom circuit using Poseidon hashing
      • Commitment scheme for proposal permutations and ballot validity
      • Proof verification required for turn transitions (endTurn)
    • EIP-712 Signature Workflows
      Implemented typed message signing for critical operations:

      • Game joining requires signJoiningGame, signed by GameMaster, attesting player for joining the game
      • Vote submissions now need dual signatures (GM + Voter)
      • Cryptographic commitments for proposal submissions also are signed

    Breaking Changes

    • Maximum number of participants
      Due to the limits of the ZK proof, maximum number of participants is now 15 per one game.
      We may change this later but for now this is the limit.

    • Proposal Submission

      • bytes32 commitmentHash; is now uint256 commitment;
      • gm and voter signatures were added

      new proposal params struct looks like this:

      struct ProposalParams {
        uint256 gameId;
        string encryptedProposal;
        uint256 commitment;
        address proposer;
        bytes gmSignature;
        bytes voterSignature;
      }
    • Vote Submission

      • string encryptedVotes; is now string sealedBallotId;
      • signatures for gm and voter were added
      • ballot hash is added as parameter it is calculated as keccak256(vote, playerVoteSalt)
        new interface for vote submission looks as follows:
      function submitVote(
            uint256 gameId,
            string memory sealedBallotId,
            address voter,
            bytes memory gmSignature,
            bytes memory voterSignature,
            bytes32 ballotHash
        )
    • Turn Transition Requirements

      endTurn now requires ZK proof parameters:

          function endTurn(
              uint256 gameId,
              uint256[][] memory votes,
              BatchProposalReveal memory newProposals,
              uint256[] memory permutation,
              uint256 shuffleSalt
          )

      Where BatchProposalReveal is defined as:

      /**
       * @dev Represents a batch of proposal reveals for a game.
       * @param proposals Array of revealed proposals
       * @param a ZK proof components
       * @param b ZK proof components
       * @param c ZK proof components
       * @param permutationCommitment The commitment to the permutation
       * @notice permutationCommitment must be poseidon(sponge(nextTurnPermutation), nullifier). For sponge implementation see poseidonSpongeT3
       */
      struct BatchProposalReveal {
        string[] proposals; // Array of revealed proposals
        uint[2] a; // ZK proof components
        uint[2][2] b;
        uint[2] c;
        uint256 permutationCommitment;
      }
    • Join game: signature and salt are now required

      function joinGame(
            uint256 gameId,
            bytes memory gameMasterSignature,
            bytes memory hiddenSalt
        )
    • Start game
      Now requires permutationCommitment from game master. This is used as permutation integrity value during first turn proposal reveal.

      function startGame(uint256 gameId, uint256 permutationCommitment)
    • Game Winner
      New interface to query for game winner added

      /**
       * @dev Returns the winner of the game with the specified ID
       * @param gameId The ID of the game
       * @return address The winner of the game
       */
      function gameWinner(uint256 gameId) public view returns (address) {
        return gameId.getGameState().winner;
      }
    • Player joined event
      Now when player joins, participant address and commitment are emitted

      event PlayerJoined(uint256 indexed gameId, address indexed participant, bytes hiddenSalt);

    Other Improvements

    • Enhanced Security

      • Ballot integrity checks with hash commitments
      require(
          ballotHash == ballotHashFromVotes,
          "Ballot integrity check failed"
      );
    • Testing Infrastructure
      Added comprehensive test coverage for:

      • ZK proof generation/verification workflows
      • Signature validation edge cases
      • Game cancellation scenarios
      • Malicious actor simulations
    • Governance Constraints

      • Minimum participant requirements
      • Principal cost calculations based on game parameters
      • 90/10 payment split between burn and DAO
    • GameLifeCycle script was renamed to interactive run it with
      pnpm hardhat --network $NETWORK interactive

    • all signatures are now available in ./all-signatures.json

    • pnpm clean added to clean all artifacts & zk proofs cache

    Migration Notes

    1. Client Updates Required
      All game interactions must now:

      • Generate ZK proofs for turn transitions
      • Handle EIP-712 signatures for votes/joining
    2. Upgrade Path

      pnpm update rankify-contracts
  • #110 b7081591a12eccb8a83d22d4975b4062568597c2 Thanks @peersky! - players now must submit game master signature upon joining

Patch Changes

v0.11.2

18 Jan 10:54
d3a9031
Compare
Choose a tag to compare

Patch Changes

v0.11.1

18 Jan 08:02
a8fad12
Compare
Choose a tag to compare

Patch Changes

v0.11.0

15 Jan 12:23
86f862e
Compare
Choose a tag to compare

Minor Changes

v0.10.2

14 Dec 04:45
7516748
Compare
Choose a tag to compare

Patch Changes

v0.10.1

13 Dec 05:51
869c4af
Compare
Choose a tag to compare

Patch Changes