Skip to content

Commit

Permalink
Added tests for magic num level
Browse files Browse the repository at this point in the history
  • Loading branch information
eternauta1337 committed Aug 24, 2018
1 parent 2a5de57 commit 2dc811e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion contracts/attacks/MagicNumBadSolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pragma solidity ^0.4.24;

contract MagicNumBadSolver {

function () public pure returns (uint256) {
function whatIsTheMeaningOfLife() public pure returns (bytes32) {
return 42;
}
}
2 changes: 1 addition & 1 deletion contracts/levels/MagicNum.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ contract MagicNum {

address public solver;

constructor() {}
constructor() public {}

function setSolver(address _solver) public {
solver = _solver;
Expand Down
2 changes: 1 addition & 1 deletion contracts/levels/MagicNumFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract MagicNumFactory is Level {
MagicNum instance = MagicNum(_instance);

// Retrieve the solver from the instance.
Solver solver = Solver(instance);
Solver solver = Solver(instance.solver());

// Query the solver for the magic number.
bytes32 magic = solver.whatIsTheMeaningOfLife();
Expand Down
22 changes: 1 addition & 21 deletions test/levels/MagicNum.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as utils from "../utils/TestUtils";
import expectThrow from "zeppelin-solidity/test/helpers/expectThrow";
import toPromise from "zeppelin-solidity/test/helpers/toPromise";

contract("MagicNum", function(accounts) {
contract.only("MagicNum", function(accounts) {

let ethernaut
let level
Expand Down Expand Up @@ -59,25 +59,5 @@ contract("MagicNum", function(accounts) {

assert.isTrue(completed);
});

// it("should unlock with a non-zero first byte", async function() {
// let _name = "0x0000000000000000000000000000000000000000000000000000000000000001"
// let _address = "0x123"

// // Unlock.
// await instance.register(_name, _address);
// assert.equal(await instance.unlocked(), true);

// // Factory check (should pass)
// const completed = await utils.submitLevelInstance(
// ethernaut,
// level.address,
// instance.address,
// player
// );
// assert.equal(completed, true);
// });

});

});

0 comments on commit 2dc811e

Please sign in to comment.