Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into tudor/performance_fixes
Browse files Browse the repository at this point in the history
# Conflicts:
#	go/enclave/storage/enclavedb/block.go
#	go/enclave/storage/init/sqlite/001_init.sql
  • Loading branch information
tudor-malene committed Sep 21, 2023
2 parents 4fa4dfd + c4864da commit 90711a4
Show file tree
Hide file tree
Showing 68 changed files with 1,199 additions and 235 deletions.
13 changes: 7 additions & 6 deletions contracts/config/networks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"localGeth": {
"url": "http://127.0.0.1:8025",
"url": "http://127.0.0.1:37000",
"deploy": [
"deployment_scripts/core/layer1/",
"deployment_scripts/testnet/layer1/",
Expand All @@ -13,15 +13,16 @@
},
"localObscuro": {
"chainId": 777,
"url": "http://127.0.0.1:3000/v1",
"obscuroEncRpcUrl": "ws://127.0.0.1:81",
"gasPrice": 2000000000,
"url": "http://127.0.0.1:3000/v1/",
"obscuroEncRpcUrl": "ws://127.0.0.1:37901",
"companionNetworks" : {
"layer1" : "localGeth"
},
"deploy": [
"deployment_scripts/core/layer2/",
"deployment_scripts/bridge/layer2/",
"deployment_scripts/messenger/layer1",
"deployment_scripts/messenger/layer2",
"deployment_scripts/bridge/",
"deployment_scripts/testnet/layer1/",
"deployment_scripts/testnet/layer2/"
],
"accounts": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployer } = await hre.companionNetworks.layer1.getNamedAccounts();

// Read the message bus address from the management contract deployment.
const messageBusAddress : string = process.env.MESSAGE_BUS_ADDRESS!!
const messageBusAddress : string = process.env.MESSAGE_BUS_ADDRESS || "0xa1fdA5f6Df55a326f5f4300F3A716317f0f03110"
console.log(`Message Bus address ${messageBusAddress}`);

// Setup the cross chain messenger and point it to the message bus from the management contract to be used for validation
await deployments.deploy('CrossChainMessenger', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
// Get the prefunded L2 deployer account to use for deploying.
const {deployer} = await getNamedAccounts();

console.log(`Deployer acc ${deployer}`);

// TODO: Remove hardcoded L2 message bus address when properly exposed.
const busAddress = hre.ethers.utils.getAddress("0x526c84529b2b8c11f57d93d3f5537aca3aecef9b")

console.log(`Beginning deploy of cross chain messenger`);

// Deploy the L2 Cross chain messenger and use the L2 bus for validation
await deployments.deploy('CrossChainMessenger', {
from: deployer,
from: deployer,
args: [ busAddress ],
log: true,
});
Expand Down
28 changes: 28 additions & 0 deletions contracts/deployment_scripts/testing/001_gas_testing_deployment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';
import { Receipt } from 'hardhat-deploy/dist/types';


const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const l2Network = hre;
const {deployer} = await hre.getNamedAccounts();

const gcb = await l2Network.deployments.deploy("GasConsumerBalance", {
from: deployer,
log: true
})


const gasConsumerBalance = await hre.ethers.getContractAt("GasConsumerBalance", gcb.address)
const gasEstimation = await gasConsumerBalance.estimateGas.get_balance({from: deployer});

await hre.deployments.execute("GasConsumerBalance", {
from: deployer,
gasLimit: gasEstimation.div(2),
log: true
}, "get_balance");
};


export default func;
func.tags = ['GasDebug'];
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,26 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
let messages = getXChainMessages(hocResult);
messages = messages.concat(getXChainMessages(pocResult));

console.log("Attempting to verify cross chain message transfer.");

// Poll message submission
await new Promise(async (resolve, fail)=> {
setTimeout(fail, 30_000)
const messageBusContract = (await hre.ethers.getContractAt('MessageBus', '0x526c84529b2b8c11f57d93d3f5537aca3aecef9b'));
while (await messageBusContract.callStatic.verifyMessageFinalized(messages[1]) != true) {
console.log(`Messages not stored on L2 yet, retrying...`);
await sleep(1_000);
try {
while (await messageBusContract.callStatic.verifyMessageFinalized(messages[1], {
maxFeePerGas: 2,
}) != true) {
console.log(`Messages not stored on L2 yet, retrying...`);
await sleep(1_000);
}
}catch (err) {
console.log(err)
fail(err)
}



resolve(true);
});

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/generated/EthereumBridge/EthereumBridge.go

Large diffs are not rendered by default.

Loading

0 comments on commit 90711a4

Please sign in to comment.