-
Notifications
You must be signed in to change notification settings - Fork 40
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
Upgrade OZ libraries #1707
Upgrade OZ libraries #1707
Changes from 3 commits
8099ea5
5872e66
2201141
9f25d9b
7c9d568
581c76a
e68e381
2214997
1c8f91d
1dd9db5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
// SPDX-License-Identifier: Apache 2 | ||
pragma solidity >=0.7.0 <0.9.0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider narrowing the pragma solidity version to |
||
|
||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract ConstantSupplyERC20 is ERC20 { | ||
|
||
constructor(string memory name, string memory symbol, uint256 initialSupply) ERC20(name, symbol) { | ||
contract ConstantSupplyERC20 is ERC20 { | ||
constructor(string memory name, string memory symbol, uint256 initialSupply) | ||
ERC20(name, symbol) | ||
{ | ||
_mint(msg.sender, initialSupply); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,18 @@ pragma solidity >=0.7.0 <0.9.0; | |
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; | ||
import "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol"; | ||
|
||
|
||
import "./Structs.sol"; | ||
import * as MessageBus from "../messaging/MessageBus.sol"; | ||
|
||
contract ManagementContract is Ownable, Initializable { | ||
|
||
constructor() { | ||
using MessageHashUtils for bytes32; | ||
using MessageHashUtils for bytes; | ||
|
||
constructor() Ownable(msg.sender) { | ||
// _disableInitializers(); //todo @siliev - figure out why the solidity compiler cant find this. Perhaps OZ needs a version upgrade? | ||
} | ||
|
||
|
@@ -117,10 +121,10 @@ contract ManagementContract is Ownable, Initializable { | |
// signature = f(PubKey, PrivateKey, message) | ||
// address = f(signature, message) | ||
// valid if attesterID = address | ||
bytes32 calculatedHashSigned = ECDSA.toEthSignedMessageHash(abi.encodePacked(attesterID, requesterID, hostAddress, responseSecret)); | ||
bytes32 calculatedHashSigned = abi.encodePacked(attesterID, requesterID, hostAddress, responseSecret).toEthSignedMessageHash(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was the issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope, its in the go code where the signature is generated; We need to append to correct recovery id. |
||
address recoveredAddrSignedCalculated = ECDSA.recover(calculatedHashSigned, attesterSig); | ||
|
||
require(recoveredAddrSignedCalculated == attesterID, "calculated address and attesterID dont match"); | ||
require(recoveredAddrSignedCalculated == attesterID, "calculated address and attesterID dont match"); | ||
} | ||
|
||
// mark the requesterID aggregator as an attested aggregator and store its host address | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,10 +32,20 @@ describe("Bridge", function () { | |
const L1Bridge = await hre.ethers.getContractFactory("ObscuroBridge"); | ||
const L2Bridge = await hre.ethers.getContractFactory("EthereumBridge"); | ||
|
||
const ERC20 = await hre.ethers.getContractFactory("ERC20"); | ||
const [owner] = await ethers.getSigners(); | ||
|
||
const ERC20 = await hre.ethers.getContractFactory("ConstantSupplyERC20", owner); | ||
|
||
console.log(`Deploying erc20`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider removing or commenting out the |
||
try { | ||
const erc20 = await ERC20.deploy("XXX", "XXX", 100000); | ||
erc20address = erc20.address; | ||
} catch(err) { | ||
console.error(err); | ||
} | ||
|
||
|
||
const erc20 = await ERC20.deploy("XXX", "XXX"); | ||
erc20address = erc20.address; | ||
console.log(`Deployed erc20`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider removing or commenting out the |
||
|
||
busL1 = await MessageBus.deploy(); | ||
busL2 = await MessageBus.deploy(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warning settings for files in the 'src/testing' directory have been turned off. This could potentially hide important warnings during the testing phase. It's recommended to only disable specific warnings that are known to be non-critical after thorough evaluation.