Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed May 2, 2024
2 parents 8dcb272 + ad92a14 commit e2ab104
Show file tree
Hide file tree
Showing 20 changed files with 8,087 additions and 10,210 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: rm packages/protocol/package.json

- name: Run Slither
uses: crytic/[email protected].1
uses: crytic/[email protected].2
id: slither
with:
target: packages/protocol
Expand Down
26 changes: 13 additions & 13 deletions packages/bridge-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
"devDependencies": {
"@playwright/test": "^1.43.1",
"@sveltejs/adapter-auto": "^3.2.0",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.30.4",
"@sveltejs/kit": "^2.5.7",
"@sveltejs/vite-plugin-svelte": "^3.1.0",
"@types/debug": "^4.1.12",
"@types/object-hash": "^3.0.6",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@vitest/coverage-v8": "^1.4.0",
"@wagmi/cli": "^2.1.4",
"abitype": "^1.0.2",
"ajv": "^8.12.0",
"autoprefixer": "^10.4.18",
"daisyui": "^4.7.2",
"daisyui": "^4.10.3",
"dotenv": "^16.4.5",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -45,23 +45,23 @@
"lokijs": "^1.5.12",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.2",
"svelte": "^4.2.12",
"svelte-check": "^3.6.9",
"prettier-plugin-svelte": "^3.2.3",
"svelte": "^4.2.15",
"svelte-check": "^3.7.0",
"tailwindcss": "^3.4.3",
"ts-morph": "^19.0.0",
"tslib": "^2.6.2",
"typescript": "^5.4.3",
"vite": "^4.5.3",
"vite": "^5.2.10",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^0.32.4",
"vitest": "^1.5.3",
"vitest-fetch-mock": "^0.2.2",
"vitest-mock-extended": "1.3.1"
},
"type": "module",
"dependencies": {
"@wagmi/connectors": "^4.1.18",
"@wagmi/core": "^2.8.0",
"@wagmi/connectors": "^4.3.1",
"@wagmi/core": "^2.8.1",
"@walletconnect/ethereum-provider": "^2.12.2",
"@walletconnect/modal": "^2.6.2",
"@web3modal/wagmi": "^4.1.11",
Expand All @@ -71,7 +71,7 @@
"debug": "^4.3.4",
"events": "^3.3.0",
"object-hash": "^3.0.0",
"svelte-i18n": "^3.7.4",
"svelte-i18n": "^4.0.0",
"viem": "^2.9.29"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@

<script lang="ts">
import { SvelteToast } from '@zerodevx/svelte-toast';
import type { SvelteToastOptions } from '@zerodevx/svelte-toast/stores';
const options: SvelteToastOptions = {
const options = {
duration: toastConfig.duration,
};
</script>
Expand Down
29 changes: 29 additions & 0 deletions packages/bridge-ui/src/tests/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,32 @@ import dotenv from 'dotenv';
dotenv.config({ path: './.env.test' });

vi.mock('@wagmi/core');

// Source: https://github.com/vitest-dev/vitest/issues/4043#issuecomment-1905172846
// This snippet is needed in order to support Uint8Array with vitest and jsdom.
if (process.env.VITEST === 'true') {
class ESBuildAndJSDOMCompatibleTextEncoder extends TextEncoder {
constructor() {
super();
}

encode(input: string) {
if (typeof input !== 'string') {
throw new TypeError('`input` must be a string');
}

const decodedURI = decodeURIComponent(encodeURIComponent(input));
const arr = new Uint8Array(decodedURI.length);
const chars = decodedURI.split('');
for (let i = 0; i < chars.length; i++) {
arr[i] = decodedURI[i].charCodeAt(0);
}
return arr;
}
}

Object.defineProperty(global, 'TextEncoder', {
value: ESBuildAndJSDOMCompatibleTextEncoder,
writable: true,
});
}
4 changes: 2 additions & 2 deletions packages/bridge-ui/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/kit/vite';
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
Expand Down
4 changes: 2 additions & 2 deletions packages/bridge-ui/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sveltekit } from '@sveltejs/kit/vite';
import dotenv from 'dotenv';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineProject } from 'vitest/dist/config';

import { generateBridgeConfig } from './scripts/vite-plugins/generateBridgeConfig';
import { generateChainConfig } from './scripts/vite-plugins/generateChainConfig';
Expand All @@ -13,7 +13,7 @@ if (process.env.NODE_ENV === 'test') {
dotenv.config({ path: './.env.test' });
}

export default defineProject({
export default defineConfig({
build: {
sourcemap: true,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/contracts/L1/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ contract TaikoL1 is EssentialContract, ITaikoL1, TaikoEvents, TaikoErrors {

/// @dev Allows for receiving Ether from Hooks
receive() external payable {
if (!_inNonReentrant()) revert L1_RECEIVE_DISABLED();
if (!inNonReentrant()) revert L1_RECEIVE_DISABLED();
}

/// @notice Initializes the contract.
Expand Down
12 changes: 6 additions & 6 deletions packages/protocol/contracts/common/EssentialContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,20 @@ abstract contract EssentialContract is UUPSUpgradeable, Ownable2StepUpgradeable,
return __paused == _TRUE;
}

function inNonReentrant() public view returns (bool) {
return _loadReentryLock() == _TRUE;
}

/// @notice Initializes the contract.
/// @param _owner The owner of this contract. msg.sender will be used if this value is zero.
/// @param _addressManager The address of the {AddressManager} contract.
function __Essential_init(address _owner, address _addressManager) internal onlyInitializing {
function __Essential_init(address _owner, address _addressManager) internal {
if (_addressManager == address(0)) revert ZERO_ADDR_MANAGER();
__Essential_init(_owner);
__AddressResolver_init(_addressManager);
}

function __Essential_init(address _owner) internal virtual {
function __Essential_init(address _owner) internal virtual onlyInitializing {
__Context_init();
_transferOwnership(_owner == address(0) ? msg.sender : _owner);
__paused = _FALSE;
Expand Down Expand Up @@ -148,8 +152,4 @@ abstract contract EssentialContract is UUPSUpgradeable, Ownable2StepUpgradeable,
reentry_ = __reentry;
}
}

function _inNonReentrant() internal view returns (bool) {
return _loadReentryLock() == _TRUE;
}
}
4 changes: 2 additions & 2 deletions packages/protocol/contracts/signal/ISignalService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ interface ISignalService {

/// @notice Emitted when an address is authorized or deauthorized.
/// @param addr The address to be authorized or deauthorized.
/// @param authrized True if authorized, false otherwise.
event Authorized(address indexed addr, bool authrized);
/// @param authorized True if authorized, false otherwise.
event Authorized(address indexed addr, bool authorized);

/// @notice Send a signal (message) by setting the storage slot to a value of 1.
/// @param _signal The signal (message) to send.
Expand Down
10 changes: 5 additions & 5 deletions packages/protocol/contracts/signal/SignalService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract SignalService is EssentialContract, ISignalService {
error SS_SIGNAL_NOT_FOUND();
error SS_UNAUTHORIZED();

modifier validSender(address _app) {
modifier nonZeroApp(address _app) {
if (_app == address(0)) revert SS_INVALID_SENDER();
_;
}
Expand Down Expand Up @@ -204,7 +204,7 @@ contract SignalService is EssentialContract, ISignalService {
internal
view
virtual
validSender(_app)
nonZeroApp(_app)
nonZeroValue(_signal)
nonZeroValue(_value)
returns (bytes32)
Expand Down Expand Up @@ -245,7 +245,7 @@ contract SignalService is EssentialContract, ISignalService {
bytes32 _value
)
private
validSender(_app)
nonZeroApp(_app)
nonZeroValue(_signal)
nonZeroValue(_value)
returns (bytes32 slot_)
Expand Down Expand Up @@ -287,7 +287,7 @@ contract SignalService is EssentialContract, ISignalService {
)
private
view
validSender(_app)
nonZeroApp(_app)
nonZeroValue(_signal)
returns (bytes32 value_)
{
Expand All @@ -306,7 +306,7 @@ contract SignalService is EssentialContract, ISignalService {
)
private
view
validSender(_app)
nonZeroApp(_app)
nonZeroValue(_signal)
returns (CacheAction[] memory actions)
{
Expand Down
129 changes: 0 additions & 129 deletions packages/protocol/contracts/team/airdrop/ERC20Airdrop2.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity 0.8.24;
/// @title RLPReader
/// @notice RLPReader is a library for parsing RLP-encoded byte arrays into Solidity types. Adapted
/// from Solidity-RLP (https://github.com/hamdiallam/Solidity-RLP) by Hamdi Allam with
/// various tweaks to improve readability.
/// various tweaks to improve readability. (A shout-out to Optimism !)
library RLPReader {
/// @notice Custom pointer type to avoid confusion between pointers and uint256s.
type MemoryPointer is uint256;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity 0.8.24;
/// @title RLPWriter
/// @author RLPWriter is a library for encoding Solidity types to RLP bytes. Adapted from Bakaoh's
/// RLPEncode library (https://github.com/bakaoh/solidity-rlp-encode) with minor
/// modifications to improve legibility.
/// modifications to improve legibility. (A shout-out to Optimism !)
library RLPWriter {
/// @notice RLP encodes a byte string.
/// @param _in The byte string to encode.
Expand Down
Loading

0 comments on commit e2ab104

Please sign in to comment.