Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
attente committed Feb 28, 2018
1 parent d8cae55 commit ec0ae64
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
21 changes: 16 additions & 5 deletions contracts/Arcadeum.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ contract Arcadeum {
string private constant MESSAGE_PREFIX = 'Sign to play! This won\'t cost anything.\n';
string private constant PLAYER_PREFIX = '\nPlayer: 0x';

// XXX: https://github.com/ethereum/solidity/issues/3270
// *** MUST MATCH DGame.sol ***
uint private constant PUBLIC_SEED_LENGTH = 1;
uint private constant META_STATE_DATA_LENGTH = 3;
uint private constant STATE_DATA_LENGTH = 1;

struct Match {
DGame game;
uint32 matchID;
Expand All @@ -25,7 +31,8 @@ contract Arcadeum {
// XXX: https://github.com/ethereum/solidity/issues/3275#issuecomment-365087323
SubkeySignature subkeySignature;
TimestampSignature timestampSignature;
bytes publicSeed;
// XXX: https://github.com/ethereum/solidity/issues/3270
bytes32[PUBLIC_SEED_LENGTH] publicSeed;
}

struct Move {
Expand Down Expand Up @@ -190,7 +197,8 @@ contract Arcadeum {
isMatchFinal[gameMatchID] = true;
}

function canReportCheater(Match aMatch, bytes reporterPublicSeed, DGame.MetaState metaState, Move cheaterMove) public view returns (bool) {
// XXX: https://github.com/ethereum/solidity/issues/3270
function canReportCheater(Match aMatch, bytes32[PUBLIC_SEED_LENGTH] reporterPublicSeed, DGame.MetaState metaState, Move cheaterMove) public view returns (bool) {
bytes24 gameMatchID;
address opponent;

Expand All @@ -217,8 +225,9 @@ contract Arcadeum {
return true;
}

// XXX: https://github.com/ethereum/solidity/issues/3270
// XXX: https://github.com/ethereum/solidity/issues/3199#issuecomment-365035663
function reportCheater(Match aMatch, bytes reporterPublicSeed, DGame.MetaState metaState, Move cheaterMove) public {
function reportCheater(Match aMatch, bytes32[PUBLIC_SEED_LENGTH] reporterPublicSeed, DGame.MetaState metaState, Move cheaterMove) public {
bytes24 gameMatchID;
address opponent;

Expand Down Expand Up @@ -287,11 +296,13 @@ contract Arcadeum {
return subkeyParent(subkey, subkeySignature);
}

function matchHash(DGame game, uint32 matchID, uint timestamp, address[2] accounts, bytes[2] publicSeeds) public pure returns (bytes32) {
// XXX: https://github.com/ethereum/solidity/issues/3270
function matchHash(DGame game, uint32 matchID, uint timestamp, address[2] accounts, bytes32[PUBLIC_SEED_LENGTH][2] publicSeeds) public pure returns (bytes32) {
return keccak256(game, matchID, timestamp, accounts[0], accounts[1], publicSeeds[0], publicSeeds[1]);
}

function matchMaker(Match aMatch, address sender, bytes senderPublicSeed) private pure returns (address) {
// XXX: https://github.com/ethereum/solidity/issues/3270
function matchMaker(Match aMatch, address sender, bytes32[PUBLIC_SEED_LENGTH] senderPublicSeed) private pure returns (address) {
address opponent;
bytes32 hash;

Expand Down
15 changes: 12 additions & 3 deletions contracts/DGame.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ pragma solidity ^0.4.19;
pragma experimental ABIEncoderV2;

contract DGame {
// XXX: https://github.com/ethereum/solidity/issues/3270
// *** MUST MATCH Arcadeum.sol ***
uint private constant PUBLIC_SEED_LENGTH = 1;
uint private constant META_STATE_DATA_LENGTH = 3;
uint private constant STATE_DATA_LENGTH = 1;

enum Winner {
NONE,
PLAYER_0,
Expand All @@ -18,7 +24,8 @@ contract DGame {
struct MetaState {
uint32 nonce;
MetaTag tag;
bytes data;
// XXX: https://github.com/ethereum/solidity/issues/3270
bytes32[META_STATE_DATA_LENGTH] data;
State state;
}

Expand All @@ -28,7 +35,8 @@ contract DGame {

struct State {
uint32 tag;
bytes data;
// XXX: https://github.com/ethereum/solidity/issues/3270
bytes32[STATE_DATA_LENGTH] data;
}

struct Move {
Expand All @@ -45,7 +53,8 @@ contract DGame {
function secretSeedRating(address account, bytes secretSeed) public view returns (uint32) {
}

function publicSeed(address account, bytes secretSeed) public view returns (bytes) {
// XXX: https://github.com/ethereum/solidity/issues/3270
function publicSeed(address account, bytes secretSeed) public view returns (bytes32[PUBLIC_SEED_LENGTH]) {
}

function winner(MetaState metaState) public pure returns (Winner) {
Expand Down

0 comments on commit ec0ae64

Please sign in to comment.