Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge v3 #7

Draft
wants to merge 8 commits into
base: bridge-v2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions Bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ contract Bridge is EthTokenReciever {
require(
checkSignatures(
keccak256(
abi.encodePacked(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transition from encode to encodePacked is not that necessary but might be taken as it may only affect the order of the params for the statement we sign but not the signature itself
Just make sure that it works fine when passing params to recoverAddress, now it looks okay, but it will not be superfluous to double check it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's needed to prevent signature collision

abi.encode(
"migrate",
address(this),
newContractAddress,
salt,
Expand Down Expand Up @@ -306,7 +307,8 @@ contract Bridge is EthTokenReciever {
require(
checkSignatures(
keccak256(
abi.encodePacked(
abi.encode(
"addAsset",
address(this),
name,
symbol,
Expand Down Expand Up @@ -412,9 +414,9 @@ contract Bridge is EthTokenReciever {
require(
checkSignatures(
keccak256(
abi.encodePacked(
address(this),
abi.encode(
"addPeer",
address(this),
newPeerAddress,
txHash,
_networkId
Expand Down Expand Up @@ -453,9 +455,9 @@ contract Bridge is EthTokenReciever {
require(
checkSignatures(
keccak256(
abi.encodePacked(
address(this),
abi.encode(
"removePeer",
address(this),
peerAddress,
txHash,
_networkId
Expand Down Expand Up @@ -499,7 +501,8 @@ contract Bridge is EthTokenReciever {
require(
checkSignatures(
keccak256(
abi.encodePacked(
abi.encode(
"transfer",
address(this),
tokenAddress,
amount,
Expand Down Expand Up @@ -557,7 +560,8 @@ contract Bridge is EthTokenReciever {
require(
checkSignatures(
keccak256(
abi.encodePacked(
abi.encode(
"transfer",
address(this),
sidechainAssetId,
amount,
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { default as mainnetConfig } from "../deploy-data/mainnet"
async function main() {
const hh: HardhatRuntimeEnvironment = require("hardhat");
const config = mainnetConfig;
const bridgeAddress = "0x5c9e99599Fdbbb261dA0BDe3b8daD5601d332E8F";
const bridgeAddress = "0x6F984C337aD5b7C2084805042AE942cef462e3ff";
let tokenAddresses = config.sidechainAssets.map((val) => val.address);
let assetIds = config.sidechainAssets.map((val) => val.asset_id);
await hh.run("verify:verify", {
Expand Down