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

chore: upgrade testnets to v0.7.9 #360

Merged
merged 7 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions contracts/impls/apps/WitnetPriceFeedsUpgradable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ contract WitnetPriceFeedsUpgradable
}
__feed.latestValidQueryId = _latestId;
} else {
// Otherwise, delete latest query, as it was faulty
// Otherwise, try to delete latest query, as it was faulty
// and we are about to post a new update request:
witnet.deleteQuery(_latestId);
try witnet.deleteQuery(_latestId) {} catch {}
}
// Post update request to the WRB:
_latestId = witnet.postRequest{value: _usedFunds}(__feed.radHash, _slaHash);
Expand Down
8 changes: 6 additions & 2 deletions contracts/impls/core/WitnetBytecodesDefault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ contract WitnetBytecodesDefault
}

// Calculate radhash and add request metadata and rad bytecode to storage:
_radHash = _bytecode.hash();
_radHash = _witnetHash(_bytecode);
__database().rads[hash] = _radHash;
__database().radsBytecode[_radHash] = _bytecode;
__database().requests[_radHash] = RadonRequest({
Expand Down Expand Up @@ -603,7 +603,7 @@ contract WitnetBytecodesDefault
bytes memory _bytecode = _sla.encode();

// Calculate hash and add to storage if new:
_slaHash = _bytecode.hash();
_slaHash = _witnetHash(_bytecode);
if (__database().slas[_slaHash].numWitnesses == 0) {
__database().slas[_slaHash] = _sla;
__database().slasBytecode[_slaHash] = _bytecode;
Expand Down Expand Up @@ -660,4 +660,8 @@ contract WitnetBytecodesDefault
}
}

function _witnetHash(bytes memory chunk) virtual internal pure returns (bytes32) {
return sha256(chunk);
}

}
20 changes: 20 additions & 0 deletions contracts/impls/core/customs/WitnetBytecodesNoSha256.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "../WitnetBytecodesDefault.sol";

contract WitnetBytecodesNoSha256 is WitnetBytecodesDefault {

constructor(
bool _upgradable,
bytes32 _versionTag
)
WitnetBytecodesDefault(_upgradable, _versionTag)
{}

function _witnetHash(bytes memory chunk) virtual override internal pure returns (bytes32) {
return keccak256(chunk);
}
}
28 changes: 28 additions & 0 deletions contracts/impls/core/customs/WitnetRequestFactoryCfxCore.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "../WitnetRequestFactoryDefault.sol";

contract WitnetRequestFactoryCfxCore is WitnetRequestFactoryDefault {
constructor(
WitnetBytecodes _registry,
bool _upgradable,
bytes32 _versionTag
)
WitnetRequestFactoryDefault(_registry, _upgradable, _versionTag)
{}

function _cloneDeterministic(bytes32 _salt)
override internal
returns (address _instance)
{
bytes memory ptr = _cloneBytecodePtr();
assembly {
// CREATE2 new instance:
_instance := create2(0, ptr, 0x37, _salt)
}
emit Cloned(msg.sender, self(), _instance);
}
}
2 changes: 1 addition & 1 deletion contracts/libs/Witnet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ library Witnet {
) {
return sha256(_bytecode);
} else {
return 0x0;
return keccak256(_bytecode);
}
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/patterns/Clonable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ abstract contract Clonable
/// @dev See https://eips.ethereum.org/EIPS/eip-1167.
/// @dev See https://blog.openzeppelin.com/deep-dive-into-the-minimal-proxy-contract/.
function _cloneDeterministic(bytes32 _salt)
internal
virtual internal
returns (address _instance)
{
bytes memory ptr = _cloneBytecodePtr();
Expand Down
476 changes: 331 additions & 145 deletions migrations/witnet.addresses.json

Large diffs are not rendered by default.

84 changes: 62 additions & 22 deletions migrations/witnet.settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@
boba: {
WitnetRequestBoard: "WitnetRequestBoardTrustableOvm2",
},
conflux: {
WitnetRequestFactory: "WitnetRequestFactoryCfxCore",
},
optimism: {
WitnetRequestBoard: "WitnetRequestBoardTrustableOvm2",
},
"polygon.zkevm.goerli": {
WitnetBytecodes: "WitnetBytecodesNoSha256",
},
reef: {
WitnetRequestBoard: "WitnetRequestBoardTrustableReef",
},
scroll: {
WitnetBytecodes: "WitnetBytecodesNoSha256",
}

Check failure on line 27 in migrations/witnet.settings.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Missing trailing comma
},
compilers: {
default: {
Expand All @@ -29,11 +38,6 @@
},
},
},
conflux: {
solc: {
evmVersion: "petersburg",
},
},
},
constructorParams: {
default: {
Expand Down Expand Up @@ -134,6 +138,10 @@
host: "localhost",
port: 8545,
skipDryRun: true,
verify: {
apiUrl: "https://api-goerli.etherscan.io/",
browserURL: "https://goerli.etherscan.io/",
},
},
"ethereum.kovan": {
network_id: 42,
Expand Down Expand Up @@ -165,6 +173,10 @@
host: "localhost",
port: 8517,
skipDryRun: true,
verify: {
apiUrl: "https://api-goerli.arbiscan.io/",
browserURL: "https://goerli.arbiscan.io/",
},
},
"arbitrum.one": {
network_id: 42161,
Expand All @@ -173,7 +185,7 @@
skipDryRun: true,
verify: {
apiUrl: "https://api.arbiscan.io/api",
browserURL: "https://arbiscan.io/address",
browserURL: "https://arbiscan.io/",
},
},
},
Expand All @@ -191,6 +203,11 @@
port: 8533,
skipDryRun: true,
gasPrice: 30 * 10 ** 9,
verify: {
apiKey: "MY_API_KEY",
apiUrl: "https://api-testnet.snowtrace.io/",
browserURL: "https://testnet.snowtrace.io/",
},
},
},
boba: {
Expand All @@ -216,29 +233,21 @@
apiKey: "MY_API_KEY",
},
},
"boba.moonbeam.bobabase": {
network_id: 1297,
host: "localhost",
port: 8518,
skipDryRun: true,
},
"boba.ethereum.mainnet": {
network_id: 288,
host: "localhost",
port: 9539,
skipDryRun: true,
},
"boba.ethereum.rinkeby": {
network_id: 28,
host: "localhost",
port: 8539,
skipDryRun: true,
},
"boba.ethereum.goerli": {
network_id: 2888,
host: "localhost",
port: 8515,
skipDryRun: true,
verify: {
apiUrl: "https://api-testnet.bobascan.com/api",
browserURL: "https://testnet.bobascan.com/",
},
},
},
celo: {
Expand All @@ -247,6 +256,11 @@
host: "localhost",
port: 8538,
skipDryRun: true,
verify: {
apiKey: "MY_API_KEY",
apiUrl: "https://explorer.celo.org/alfajores/api",
browserURL: "https://explorer.celo.org/alfajores/",
},
},
"celo.mainnet": {
network_id: 42220,
Expand Down Expand Up @@ -293,6 +307,10 @@
port: 8530,
network_id: 338,
skipDryRun: true,
verify: {
apiUrl: "https://cronos.org/explorer/testnet3/api",
browserURL: "https://cronos.org/explorer/testnet3",
},
},
"cronos.mainnet": {
host: "localhost",
Expand Down Expand Up @@ -323,6 +341,12 @@
port: 8519,
network_id: 568,
skipDryRun: true,
gas: 6000000,
verify: {
apiKey: "MY_API_KEY",
apiUrl: "http://explorer-testnet.dogechain.dog/api",
browserURL: "https://explorer-testnet.dogechain.dog/",
},
},
"dogechain.mainnet": {
host: "localhost",
Expand All @@ -338,6 +362,7 @@
network_id: 21,
skipDryRun: true,
verify: {
apiKey: "MY_API_KEY",
apiUrl: "https://esc-testnet.elastos.io/api",
browserURL: "https://esc-testnet.elastos.io/address",
},
Expand Down Expand Up @@ -407,6 +432,11 @@
port: 8526,
network_id: 2221,
skipDryRun: true,
verify: {
apiKey: "MY_API_KEY",
apiUrl: "https://explorer.testnet.kava.io/api",
browserURL: "https://explorer.testnet.kava.io/",
},
},
"kava.mainnet": {
host: "localhost",
Expand All @@ -422,6 +452,11 @@
network_id: 322,
gasPrice: 10 ** 10,
skipDryRun: true,
verify: {
apiKey: "MY_API_KEY",
apiUrl: "https://scan-testnet.kcc.network/api",
browserURL: "https://scan-testnet.kcc.network/",
},
},
"kcc.mainnet": {
host: "localhost",
Expand Down Expand Up @@ -462,7 +497,7 @@
verify: {
apiKey: "MY_API_KEY",
apiUrl: "https://goerli.explorer.metisdevops.link/api",
explorerUrl: "https://goerli.explorer.metisdevops.link//address",
explorerUrl: "https://goerli.explorer.metisdevops.link/address",
},
},
},
Expand Down Expand Up @@ -521,6 +556,11 @@
port: 8520,
network_id: 420,
skipDryRun: true,
verify: {
apiKey: "MY_API_KEY",
apiUrl: "https://optimism-goerli.blockscout.com/api",
explorerUrl: "https://optimism-goerli.blockscout.com/",
},
},
"optimism.mainnet": {
host: "localhost",
Expand Down Expand Up @@ -548,7 +588,7 @@
network_id: 1442,
skipDryRun: true,
verify: {
apiUrl: "http://api-testnet-zkevm.polygonscan.com/api",
apiUrl: "https://api-testnet-zkevm.polygonscan.com/api",
explorerUrl: "https://testnet-zkevm.polygonscan.com/address",
},
},
Expand All @@ -575,9 +615,9 @@
skipDryRun: true,
gasPrice: 3000000,
verify: {
apiKey: "abc",
apiUrl: "https://blockscout.scroll.io/api",
apiKey: "MY_API_KEY",
explorerUrl: "https://blockscout.scroll.io/address",
explorerUrl: "https://blockscout.scroll.io/",
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ module.exports = {
],
api_keys: {
arbiscan: process.env.ARBISCAN_API_KEY,
bobascan: process.env.BOBASCAN_API_KEY,
cronos: process.env.CRONOSCAN_API_KEY,
etherscan: process.env.ETHERSCAN_API_KEY,
moonscan: process.env.MOONSCAN_API_KEY,
polygonscan: process.env.POLYGONSCAN_API_KEY,
Expand Down
Loading