Skip to content

Commit

Permalink
use bytes8 for colormap hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabnock01 committed Nov 5, 2023
1 parent 55b58e1 commit 5b0470c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AuthorshipTokenTest:test_curtaMint() (gas: 85648)
AuthorshipTokenTest:test_curtaMint_SenderIsNotCurta_RevertsUnauthorized(address) (runs: 256, μ: 10204, ~: 10204)
AuthorshipTokenTest:test_ownerMint_FuzzMintTimestamps_IssuesTokensCorrectly(uint256) (runs: 256, μ: 6429317, ~: 5952400)
AuthorshipTokenTest:test_ownerMint_FuzzMintTimestamps_IssuesTokensCorrectly(uint256) (runs: 256, μ: 6416430, ~: 6008044)
AuthorshipTokenTest:test_ownerMint_SenderIsNotOwner_RevertUnauthorized(address) (runs: 256, μ: 12935, ~: 12935)
AuthorshipTokenTest:test_ownerMint_SenderIsOwner_AllowsMint() (gas: 108202)
AuthorshipTokenTest:test_tokenURI_MintedToken_Succeeds() (gas: 232)
Expand Down Expand Up @@ -29,7 +29,7 @@ CurtaTest:test_solve() (gas: 657540)
CurtaTest:test_solve_DuringAllPhases_FirstSolveTimestampOnlySetOnFirstBlood(uint40) (runs: 256, μ: 520949, ~: 520275)
CurtaTest:test_solve_DuringPhase1WithPayment_PaysAuthor(uint256) (runs: 256, μ: 495665, ~: 496974)
CurtaTest:test_solve_DuringPhase2WithPayment_PaysAuthor(uint256) (runs: 256, μ: 533897, ~: 533897)
CurtaTest:test_solve_DuringPhase2_RequiresETH(uint256) (runs: 256, μ: 489406, ~: 487644)
CurtaTest:test_solve_DuringPhase2_RequiresETH(uint256) (runs: 256, μ: 489380, ~: 487644)
CurtaTest:test_solve_DuringPhase3_Fails(uint40) (runs: 256, μ: 434098, ~: 434098)
CurtaTest:test_solve_FirstBlood_AuthorshipTokenMintPotentialRevertBranch() (gas: 311249)
CurtaTest:test_solve_FirstBlood_MintsAuthorshipToken() (gas: 413358)
Expand Down
42 changes: 20 additions & 22 deletions src/FlagRenderer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -296,28 +296,26 @@ contract FlagRenderer {
{
uint256 seed = uint256(keccak256(abi.encodePacked(_tokenId, _solveMetadata)));
// Select the colormap.
bytes8 colormapHash = bytes8(
[
bytes32(0xfd29b65966772202ffdb08f653439b30c849f91409915665d99dbfa5e5dab938),
bytes32(0x850ce48e7291439b1e41d21fc3f75dddd97580a4ff94aa9ebdd2bcbd423ea1e8),
bytes32(0x4f5e8ea8862eff315c110b682ee070b459ba8983a7575c9a9c4c25007039109d),
bytes32(0xf2e92189cb6903b98d854cd74ece6c3fafdb2d3472828a950633fdaa52e05032),
bytes32(0xa33e6c7c5627ecabfd54c4d85f9bf04815fe89a91379fcf56ccd8177e086db21),
bytes32(0xaa84b30df806b46f859a413cb036bc91466307aec5903fc4635c00a421f25d5c),
bytes32(0x864a6ee98b9b21ac0291523750d637250405c24a6575e1f75cfbd7209a810ce6),
bytes32(0xfd60cd3811f002814944a7d36167b7c9436187a389f2ee476dc883e37dc76bd2),
bytes32(0xa8309447f8bd3b5e5e88a0abc05080b7682e4456c388b8636d45f5abb2ad2587),
bytes32(0x3be719b0c342797212c4cb33fde865ed9cbe486eb67176265bc0869b54dee925),
bytes32(0xca0da6b6309ed2117508207d68a59a18ccaf54ba9aa329f4f60a77481fcf2027),
bytes32(0x5ccb29670bb9de0e3911d8e47bde627b0e3640e49c3d6a88d51ff699160dfbe1),
bytes32(0x3de8f27f386dab3dbab473f3cc16870a717fe5692b4f6a45003d175c559dfcba),
bytes32(0x026736ef8439ebcf8e7b8006bf8cb7482ced84d71b900407a9ed63e1b7bfe234),
bytes32(0xc1806ea961848ac00c1f20aa0611529da522a7bd125a3036fe4641b07ee5c61c),
bytes32(0x87970b686eb726750ec792d49da173387a567764d691294d764e53439359c436),
bytes32(0xaa6277ab923279cf59d78b9b5b7fb5089c90802c353489571fca3c138056fb1b),
bytes32(0xdc1cecffc00e2f3196daaf53c27e53e6052a86dc875adb91607824d62469b2bf)
][seed % 18]
);
bytes8 colormapHash = [
bytes8(0xfd29b65966772202),
bytes8(0x850ce48e7291439b),
bytes8(0x4f5e8ea8862eff31),
bytes8(0xf2e92189cb6903b9),
bytes8(0xa33e6c7c5627ecab),
bytes8(0xaa84b30df806b46f),
bytes8(0x864a6ee98b9b21ac),
bytes8(0xfd60cd3811f00281),
bytes8(0xa8309447f8bd3b5e),
bytes8(0x3be719b0c3427972),
bytes8(0xca0da6b6309ed211),
bytes8(0x5ccb29670bb9de0e),
bytes8(0x3de8f27f386dab3d),
bytes8(0x026736ef8439ebcf),
bytes8(0xc1806ea961848ac0),
bytes8(0x87970b686eb72675),
bytes8(0xaa6277ab923279cf),
bytes8(0xdc1cecffc00e2f31)
][seed % 18];

// We start at the middle of the board.
uint256 index = 210;
Expand Down

0 comments on commit 5b0470c

Please sign in to comment.