Skip to content

Commit

Permalink
Merge pull request #1 from scroll-tech/feat-add-solutions
Browse files Browse the repository at this point in the history
feat: add solutions
  • Loading branch information
Thegaram authored Nov 11, 2024
2 parents 5c4c2a2 + 3c8d4ca commit 6a2c7fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
forge build --sizes
id: build

# - name: Run Forge tests
# run: |
# forge test -vvv
# id: test
- name: Run Forge tests
run: |
forge test -vvv
id: test
4 changes: 3 additions & 1 deletion src/Part1_Counter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ contract CounterReader {
/// @notice Reads `number` and `map[123]` from L1 using L1SLOAD
/// @dev This function reads values from L1
function readCounter() external view returns (uint256, uint256) {
// TODO: complete this function
bytes32 mappingSlot = keccak256(abi.encode( /* mapping key: */ 123, /* mapping slot: */ 1));
(uint256 val0, uint256 val1) = L1SLOAD.readUint256(counter, bytes32(uint256(0)), mappingSlot);
return (val0, val1);
}
}
4 changes: 3 additions & 1 deletion src/Part3_Keystore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ contract L2Wallet is Wallet {
/// @inheritdoc Wallet
/// @dev This function reads the signer value from L1
function isAuthorized(address signer) public view override returns (bool) {
// TODO: complete this function
bytes32 mappingSlot = keccak256(abi.encode( /* mapping key: */ signer, /* mapping slot: */ 0));
bool authorized = L1SLOAD.readBool(l1Wallet, mappingSlot);
return authorized;
}
}

0 comments on commit 6a2c7fb

Please sign in to comment.