diff --git a/.circleci/config.yml b/.circleci/config.yml index 93c84834f1..20c05ab2dd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -206,17 +206,6 @@ jobs: test_folder: "eth-l2" - report-integration-tests - integration-tests-avalanche: - executor: intergration-tests-executor - parallelism: 4 - steps: - - download-solidity-compilers - - run-integration-tests: - docker_compose_file: "docker-compose-avalanche.yml" - docker_compose_side_file: "docker-compose-avalanche-side.yml" - test_folder: "alt-l2" - - report-integration-tests - integration-tests-bnb: executor: intergration-tests-executor parallelism: 4 @@ -232,7 +221,6 @@ workflows: main: jobs: - integration-tests - #- integration-tests-avalanche - integration-tests-bnb - go-lint-test-build: name: proxyd-tests diff --git a/.github/labeler.yml b/.github/labeler.yml index 9403f2e52f..4d82320189 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,13 +1,6 @@ --- 2-reviewers: - - '.github/**/*' - - 'l2geth/**/*' - - 'ops/**/*' - - 'packages/batch-submitter/**/*' - - 'packages/contracts/**/*' - - 'packages/data-transport-layer/**/*' - - 'packages/message-relayer/**/*' - - 'patches/**/*' + - any: ['.github/**/*', 'l2geth/**/*', 'ops/**/*', 'packages/batch-submitter/**/*', 'packages/contracts/**/*', 'packages/data-transport-layer/**/*', 'packages/message-relayer/**/*', 'patches/**/*'] M-ci: - any: ['.github/**/*'] diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index db02c3cd30..a885ef77de 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -22,15 +22,15 @@ jobs: - name: golangci-lint gas-oracle uses: golangci/golangci-lint-action@v3 with: - version: v1.51.0 + version: v1.56.1 working-directory: go/gas-oracle - name: golangci-lint batch-submitter uses: golangci/golangci-lint-action@v3 with: - version: v1.51.0 + version: v1.56.1 working-directory: go/batch-submitter - name: golangci-lint bss-core uses: golangci/golangci-lint-action@v3 with: - version: v1.51.0 + version: v1.56.1 working-directory: go/bss-core diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index f689dfbc35..e42b1d37eb 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -7,7 +7,7 @@ jobs: pr-labeler: runs-on: ubuntu-latest steps: - - uses: actions/labeler@main + - uses: actions/labeler@v3 with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" + repo-token: "${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" configuration-path: .github/labeler.yml diff --git a/.gitignore b/.gitignore index 27e7b7c478..11a35e86bd 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,9 @@ packages/boba/gateway/public/env.js /packages/boba/subgraph/L2/build /packages/boba/subgraph/L1/generated /packages/boba/subgraph/L2/generated +/packages/boba/subgraph/L1/rollup/generated +/packages/boba/subgraph/L1/rollup/subgraph.yaml +/packages/boba/subgraph/L1/rollup/yarn.lock # api env-mainnet.yml @@ -81,3 +84,4 @@ packages/boba/contracts/coverage/ packages/boba/account-abstraction/deployments/hardhat/ packages/boba/bundler_sdk/coverage/ + diff --git a/go/batch-submitter/drivers/proposer/driver.go b/go/batch-submitter/drivers/proposer/driver.go index 5829cffc91..13c87f0c90 100644 --- a/go/batch-submitter/drivers/proposer/driver.go +++ b/go/batch-submitter/drivers/proposer/driver.go @@ -220,7 +220,7 @@ func (d *Driver) CraftBatchTx( // so in the event their API is unreachable we can fallback to a degraded // mode of operation. This also applies to our test environments, as hardhat // doesn't support the query either. - case drivers.IsMaxPriorityFeePerGasNotFoundError(err): + case drivers.IsMaxPriorityFeePerGasNotFoundError(err) || drivers.IsMaxPriorityFeePerGasNotSupportedError(err): log.Warn(d.cfg.Name + " eth_maxPriorityFeePerGas is unsupported " + "by current backend, using fallback gasTipCap") opts.GasTipCap = drivers.FallbackGasTipCap @@ -265,7 +265,7 @@ func (d *Driver) SubmitBatchTx( // so in the event their API is unreachable we can fallback to a degraded // mode of operation. This also applies to our test environments, as hardhat // doesn't support the query either. - case drivers.IsMaxPriorityFeePerGasNotFoundError(err): + case drivers.IsMaxPriorityFeePerGasNotFoundError(err) || drivers.IsMaxPriorityFeePerGasNotSupportedError(err): log.Warn(d.cfg.Name + " eth_maxPriorityFeePerGas is unsupported " + "by current backend, using fallback gasTipCap") opts.GasTipCap = drivers.FallbackGasTipCap diff --git a/go/batch-submitter/drivers/sequencer/driver.go b/go/batch-submitter/drivers/sequencer/driver.go index 8d2ceff258..eae44665a0 100644 --- a/go/batch-submitter/drivers/sequencer/driver.go +++ b/go/batch-submitter/drivers/sequencer/driver.go @@ -251,7 +251,7 @@ func (d *Driver) CraftBatchTx( // method, so in the event their API is unreachable we can fallback to a // degraded mode of operation. This also applies to our test // environments, as hardhat doesn't support the query either. - case drivers.IsMaxPriorityFeePerGasNotFoundError(err): + case drivers.IsMaxPriorityFeePerGasNotFoundError(err) || drivers.IsMaxPriorityFeePerGasNotSupportedError(err): log.Warn(d.cfg.Name + " eth_maxPriorityFeePerGas is unsupported " + "by current backend, using fallback gasTipCap") opts.GasTipCap = drivers.FallbackGasTipCap @@ -295,7 +295,7 @@ func (d *Driver) SubmitBatchTx( // so in the event their API is unreachable we can fallback to a degraded // mode of operation. This also applies to our test environments, as hardhat // doesn't support the query either. - case drivers.IsMaxPriorityFeePerGasNotFoundError(err): + case drivers.IsMaxPriorityFeePerGasNotFoundError(err) || drivers.IsMaxPriorityFeePerGasNotSupportedError(err): log.Warn(d.cfg.Name + " eth_maxPriorityFeePerGas is unsupported " + "by current backend, using fallback gasTipCap") opts.GasTipCap = drivers.FallbackGasTipCap diff --git a/go/bss-core/drivers/clear_pending_tx.go b/go/bss-core/drivers/clear_pending_tx.go index b8117601b8..d09b41f966 100644 --- a/go/bss-core/drivers/clear_pending_tx.go +++ b/go/bss-core/drivers/clear_pending_tx.go @@ -138,7 +138,7 @@ func SignClearingTx( gasTipCap, err := l1Client.SuggestGasTipCap(ctx) if err != nil { - if !IsMaxPriorityFeePerGasNotFoundError(err) { + if !IsMaxPriorityFeePerGasNotFoundError(err) && !IsMaxPriorityFeePerGasNotSupportedError(err) { return nil, err } diff --git a/go/bss-core/drivers/max_priority_fee_fallback.go b/go/bss-core/drivers/max_priority_fee_fallback.go index 76722fcbc3..3073976a3d 100644 --- a/go/bss-core/drivers/max_priority_fee_fallback.go +++ b/go/bss-core/drivers/max_priority_fee_fallback.go @@ -11,6 +11,10 @@ var ( "Method eth_maxPriorityFeePerGas not found", ) + errMaxPriorityFeePerGasNotSupported = errors.New( + "Method eth_maxPriorityFeePerGas is not supported", + ) + // FallbackGasTipCap is the default fallback gasTipCap used when we are // unable to query an L1 backend for a suggested gasTipCap. FallbackGasTipCap = big.NewInt(1500000000) @@ -24,3 +28,12 @@ func IsMaxPriorityFeePerGasNotFoundError(err error) bool { err.Error(), errMaxPriorityFeePerGasNotFound.Error(), ) } + +// IsMaxPriorityFeePerGasNotSupportedError returns true if the provided error +// signals that the backend does not support the eth_maxPrirorityFeePerGas +// method. In this case, the caller should fallback to using the constant above. +func IsMaxPriorityFeePerGasNotSupportedError(err error) bool { + return strings.Contains( + err.Error(), errMaxPriorityFeePerGasNotSupported.Error(), + ) +} diff --git a/integration-tests/test/alt-l2/bobalink.spec.ts b/integration-tests/test/alt-l2/bobalink.spec.ts deleted file mode 100644 index 69912cf62d..0000000000 --- a/integration-tests/test/alt-l2/bobalink.spec.ts +++ /dev/null @@ -1,433 +0,0 @@ -import chai, { expect } from 'chai' -import chaiAsPromised from 'chai-as-promised' -chai.use(chaiAsPromised) -import { ethers } from 'hardhat' -import { Contract, ContractFactory, BigNumber, utils } from 'ethers' -import { getContractFactory } from '@bobanetwork/core_contracts' -import { getBobaContractAt } from '@bobanetwork/contracts' -import { bobaLinkGetQuote } from '@bobanetwork/api' -import util from 'util' - -/* eslint-disable */ -const fetch = require('node-fetch') -/* eslint-enable */ - -import { OptimismEnv } from './shared/env' -import { waitForAndExecute } from './shared/utils' -import { Server } from 'http' - -describe('BobaLink Test\n', async () => { - let env: OptimismEnv - - let BobaChainLinkOracle: Contract - let BobaOracleHC: Contract - - let Factory__TuringHelper: ContractFactory - let TuringHelper: Contract - - let BobaTuringCredit: Contract - - const apiPort = 1235 - let URL: string - - const gasOverride = { - gasLimit: 1000000, - } - - const addOracle = async ( - contract: Contract, - oracleAddr: string, - adminAddr: string, - roundId = 0 - ) => { - const admin = await contract.getAdmin() - if (admin === '0x0000000000000000000000000000000000000000') { - await contract.setOracle(oracleAddr, adminAddr, roundId) - } - } - - let server: Server - - after(async () => { - await server.close(console.error) - }) - - before(async () => { - env = await OptimismEnv.new() - - await env.l2Wallet.sendTransaction({ - to: env.l2BobalinkWallet.address, - value: utils.parseEther('100'), - }) - - const BobaTuringCreditAddress = await env.addressesBOBA.BobaTuringCredit - - BobaTuringCredit = getContractFactory( - 'BobaTuringCreditAltL1', - env.l2Wallet - ).attach(BobaTuringCreditAddress) - - Factory__TuringHelper = await ethers.getContractFactory( - 'TuringHelper', - env.l2Wallet - ) - - TuringHelper = await Factory__TuringHelper.deploy() - console.log('Helper contract deployed at', TuringHelper.address) - await TuringHelper.deployTransaction.wait() - - BobaChainLinkOracle = await getBobaContractAt( - 'FluxAggregatorHC', - env.addressesBOBA.BOBAUSD_AggregatorHC, - env.l2Wallet - ) - BobaOracleHC = await getBobaContractAt( - 'FluxAggregatorHC', - env.addressesBOBA.Proxy__BOBAUSD_AggregatorHC, - env.l2Wallet - ) - - await BobaOracleHC.updateHCHelper(TuringHelper.address) - await BobaOracleHC.updateHCChainLinkPriceFeedAddr( - BobaChainLinkOracle.address - ) - - await addOracle( - BobaOracleHC, - BobaChainLinkOracle.address, - env.l2BobalinkWallet.address - ) - await addOracle( - BobaChainLinkOracle, - BobaChainLinkOracle.address, - env.l2Wallet.address - ) - - await TuringHelper.addPermittedCaller(BobaOracleHC.address) - - // add boba as credit - const depositBOBAAmount = utils.parseEther('100') - const bobaBalance = await env.l2Wallet.getBalance() - console.log('BOBA Balance in your account', bobaBalance.toString()) - - const depositTx = await BobaTuringCredit.addBalanceTo( - depositBOBAAmount, - TuringHelper.address, - { value: depositBOBAAmount } - ) - await depositTx.wait() - - const generateBytes32 = (input: number | BigNumber) => { - return utils.hexZeroPad(utils.hexlify(input), 32).replace('0x', '') - } - - /* eslint-disable */ - const http = require('http') - const ip = require("ip") - // start local server - server = module.exports = http.createServer(async function (req, res) { - - if (req.headers['content-type'] === 'application/json') { - - let body = ''; - - req.on('data', function (chunk) { - body += chunk.toString() - }) - - req.on('end', async function () { - const jsonBody = JSON.parse(body) - const input = JSON.parse(body).params[0] - let result - - const args = utils.defaultAbiCoder.decode(['uint256', 'address', 'uint256'], input) - if (req.url === "/fake") { - const randomPrice = Math.floor(Math.random() * 1000) - result = `0x${generateBytes32(32 * 3)}${generateBytes32(args[2])}${generateBytes32(randomPrice)}${generateBytes32(args[2])}` - let response = { - "jsonrpc": "2.0", - "id": jsonBody.id, - "result": result - } - res.end(JSON.stringify(response)) - server.emit('success', body) - } - if (req.url === "/bobalink-test-api") { - const APIChainLinkContract = new Contract( - args[1], - [ - 'function getRoundData(uint80) view returns (uint80 roundId,uint256 answer,uint256 startedAt,uint256 updatedAt,uint80 answeredInRound)', - 'function latestRound() view returns (uint80 roundId)', - ], - env.l2Provider - ) - const latestRound = await APIChainLinkContract.latestRound() - const roundData = await APIChainLinkContract.getRoundData(args[2]) - result = `0x${generateBytes32(32 * 3)}${generateBytes32(roundData.roundId)}${generateBytes32(roundData.answer)}${generateBytes32(latestRound)}` - let response = { - "jsonrpc": "2.0", - "id": jsonBody.id, - "result": result - } - res.end(JSON.stringify(response)) - server.emit('success', body) - } - if (req.url === '/bobalink-prod-api') { - const asyncBobaLinkGetQuote: any = util.promisify( - bobaLinkGetQuote - ) - const response = await asyncBobaLinkGetQuote({ - body: JSON.stringify({params: [input]} - )}, null) - res.end(response.body) - server.emit('success', body) - } - if (req.url === '/invalidapi') { - res.writeHead(400, { 'Content-Type': 'text/plain' }) - res.end('Expected content-type: application/json') - } - }); - - } else { - res.writeHead(400, { 'Content-Type': 'text/plain' }) - res.end('Expected content-type: application/json') - } - }).listen(apiPort) - URL = `http://${ip.address()}:${apiPort}` - /* eslint-enable */ - }) - - it('test of local compute endpoint: should return price', async () => { - const lastRoundId = (await BobaChainLinkOracle.latestRound()).toNumber() - const decimals = await BobaChainLinkOracle.decimals() - /* eslint-disable */ - await BobaChainLinkOracle.emergencySubmit(lastRoundId + 1, utils.parseUnits('0.1', decimals), 1000) - /* eslint-enable */ - const roundId = lastRoundId + 1 - const abi_payload = utils.defaultAbiCoder.encode( - ['uint256', 'address', 'uint256'], - [64, BobaChainLinkOracle.address, roundId] - ) - - const body = { - params: [abi_payload], - } - - const resp = await fetch(`${URL}/fake`, { - method: 'POST', - body: JSON.stringify(body), - headers: { 'Content-Type': 'application/json' }, - }) - const res = await resp.json() - const result = utils.defaultAbiCoder.decode( - ['uint256', 'uint256', 'int256', 'uint80'], - res.result - ) - - expect(Number(result[0])).to.equal(32 * 3) - expect(result[1]).to.be.deep.equal(roundId) - expect(result[3]).to.be.deep.equal(roundId) - }) - - it('test of /bobalink-test-api endpoint: should return price', async () => { - const lastRoundId = (await BobaChainLinkOracle.latestRound()).toNumber() - const abi_payload = utils.defaultAbiCoder.encode( - ['uint256', 'address', 'uint256'], - [64, BobaChainLinkOracle.address, lastRoundId] - ) - - const body = { - params: [abi_payload], - } - - const resp = await fetch(`${URL}/bobalink-test-api`, { - method: 'POST', - body: JSON.stringify(body), - headers: { 'Content-Type': 'application/json' }, - }) - const res = await resp.json() - const result = utils.defaultAbiCoder.decode( - ['uint256', 'uint256', 'int256', 'uint80'], - res.result - ) - expect(Number(result[0])).to.equal(32 * 3) - expect(result[1]).to.be.deep.equal(lastRoundId) - expect(result[3]).to.be.deep.equal(lastRoundId) - }) - - it('test of /bobalink-prod-api endpoint: should return price', async () => { - process.env.L1_NODE_WEB3_URL = env.l2Provider.connection.url - const lastRoundId = (await BobaChainLinkOracle.latestRound()).toNumber() - const abi_payload = utils.defaultAbiCoder.encode( - ['uint256', 'address', 'uint256'], - [64, BobaChainLinkOracle.address, lastRoundId] - ) - - const body = { - params: [abi_payload], - } - - const resp = await fetch(`${URL}/bobalink-prod-api`, { - method: 'POST', - body: JSON.stringify(body), - headers: { 'Content-Type': 'application/json' }, - }) - const res = await resp.json() - const result = utils.defaultAbiCoder.decode( - ['uint256', 'uint256', 'int256', 'uint80'], - res.result - ) - expect(Number(result[0])).to.equal(32 * 3) - expect(result[1]).to.be.deep.equal(lastRoundId) - expect(result[3]).to.be.deep.equal(lastRoundId) - }) - - it('should get quote via Hybrid Compute', async () => { - const lastRoundId = (await BobaChainLinkOracle.latestRound()).toNumber() - await BobaOracleHC.updateHCUrl(`${URL}/fake`) - const admin = await BobaOracleHC.getAdmin() - const HCUrl = await BobaOracleHC.HCUrl() - await BobaOracleHC.connect( - env.l2BobalinkWallet - ).estimateGas.getChainLinkQuote(lastRoundId) - await BobaOracleHC.connect(env.l2BobalinkWallet).getChainLinkQuote( - lastRoundId, - gasOverride - ) - const block = await env.l2Provider.getBlockNumber() - const chainLinkQuoteEvents = await BobaOracleHC.queryFilter( - BobaOracleHC.filters.ChainLinkQuoteGot(), - block - 1, - block - ) - expect(chainLinkQuoteEvents[0].args.CLRoundId).to.equal(lastRoundId) - expect(chainLinkQuoteEvents[0].args.CLLatestRoundId).to.eq(lastRoundId) - }).retries(3) - - it('should get a single quote via bobalink using test api', async () => { - await BobaOracleHC.updateHCUrl(`${URL}/bobalink-test-api`) - const lastRoundId = (await BobaChainLinkOracle.latestRound()).toNumber() - const decimals = await BobaChainLinkOracle.decimals() - const price = utils.parseUnits('0.2', decimals) - /* eslint-disable */ - await BobaChainLinkOracle.emergencySubmit(lastRoundId + 1, price, 1000) - /* eslint-enable */ - const test = async () => { - const latestAnswer = await BobaOracleHC.latestAnswer() - const block = await env.l2Provider.getBlockNumber() - const chainLinkQuoteEvents = await BobaOracleHC.queryFilter( - BobaOracleHC.filters.ChainLinkQuoteGot(), - block, - block - ) - expect(latestAnswer).to.be.eq(price) - expect(chainLinkQuoteEvents[0].args.CLRoundId).to.equal(lastRoundId + 1) - expect(chainLinkQuoteEvents[0].args.CLLatestRoundId).to.eq( - lastRoundId + 1 - ) - } - await waitForAndExecute(test, 10) - }) - - it('should not be able to submit answer again using Hybird Compute', async () => { - const lastRoundId = (await BobaOracleHC.latestRound()).toNumber() - await expect( - BobaOracleHC.connect(env.l2BobalinkWallet).estimateGas.submit(lastRoundId) - ).to.be.revertedWith('invalid roundId to initialize') - }) - - it('should not be able to submit answer again using emergency submission', async () => { - const lastRoundId = (await BobaOracleHC.latestRound()).toNumber() - const decimals = await BobaOracleHC.decimals() - await expect( - BobaOracleHC.connect(env.l2BobalinkWallet).emergencySubmit( - lastRoundId, - utils.parseUnits('0.3', decimals), - lastRoundId - ) - ).to.be.revertedWith('invalid roundId to initialize') - }) - - it('should get multiple quotes via bobalink using test api', async () => { - await BobaOracleHC.updateHCUrl(`${URL}/bobalink-test-api`) - const lastRoundId = (await BobaChainLinkOracle.latestRound()).toNumber() - const decimals = await BobaChainLinkOracle.decimals() - const price1 = utils.parseUnits('0.4', decimals) - const price2 = utils.parseUnits('0.5', decimals) - /* eslint-disable */ - await BobaChainLinkOracle.emergencySubmit(lastRoundId + 1, price1, 1000) - await BobaChainLinkOracle.emergencySubmit(lastRoundId + 2, price2, 1000) - /* eslint-enable */ - const test = async () => { - const prevAnswer = await BobaOracleHC.getRoundData(lastRoundId + 1) - const latestAnswer = await BobaOracleHC.getRoundData(lastRoundId + 2) - const block = await env.l2Provider.getBlockNumber() - const chainLinkQuoteEvents = await BobaOracleHC.queryFilter( - BobaOracleHC.filters.ChainLinkQuoteGot(), - block, - block - ) - expect(prevAnswer.answer).to.be.eq(price1) - expect(latestAnswer.answer).to.be.eq(price2) - expect(chainLinkQuoteEvents[0].args.CLRoundId).to.equal(lastRoundId + 2) - expect(chainLinkQuoteEvents[0].args.CLLatestRoundId).to.eq( - lastRoundId + 2 - ) - } - await waitForAndExecute(test, 10) - }) - - it('should get a single quote via bobalink using prod api', async () => { - await BobaOracleHC.updateHCUrl(`${URL}/bobalink-prod-api`) - const lastRoundId = (await BobaChainLinkOracle.latestRound()).toNumber() - const decimals = await BobaChainLinkOracle.decimals() - const price = utils.parseUnits('0.6', decimals) - /* eslint-disable */ - await BobaChainLinkOracle.emergencySubmit(lastRoundId + 1, price, 1000) - /* eslint-enable */ - const test = async () => { - const latestAnswer = await BobaOracleHC.latestAnswer() - const block = await env.l2Provider.getBlockNumber() - const chainLinkQuoteEvents = await BobaOracleHC.queryFilter( - BobaOracleHC.filters.ChainLinkQuoteGot(), - block, - block - ) - expect(latestAnswer).to.be.eq(price) - expect(chainLinkQuoteEvents[0].args.CLRoundId).to.equal(lastRoundId + 1) - expect(chainLinkQuoteEvents[0].args.CLLatestRoundId).to.eq( - lastRoundId + 1 - ) - } - await waitForAndExecute(test, 10) - }) - - it('should get multiple quotes via bobalink using prod api', async () => { - await BobaOracleHC.updateHCUrl(`${URL}/bobalink-prod-api`) - const lastRoundId = (await BobaChainLinkOracle.latestRound()).toNumber() - const decimals = await BobaChainLinkOracle.decimals() - const price1 = utils.parseUnits('0.7', decimals) - const price2 = utils.parseUnits('0.8', decimals) - /* eslint-disable */ - await BobaChainLinkOracle.emergencySubmit(lastRoundId + 1, price1, 1000) - await BobaChainLinkOracle.emergencySubmit(lastRoundId + 2, price2, 1000) - /* eslint-enable */ - const test = async () => { - const prevAnswer = await BobaOracleHC.getRoundData(lastRoundId + 1) - const latestAnswer = await BobaOracleHC.getRoundData(lastRoundId + 2) - const block = await env.l2Provider.getBlockNumber() - const chainLinkQuoteEvents = await BobaOracleHC.queryFilter( - BobaOracleHC.filters.ChainLinkQuoteGot(), - block, - block - ) - expect(prevAnswer.answer).to.be.eq(price1) - expect(latestAnswer.answer).to.be.eq(price2) - expect(chainLinkQuoteEvents[0].args.CLRoundId).to.equal(lastRoundId + 2) - expect(chainLinkQuoteEvents[0].args.CLLatestRoundId).to.eq( - lastRoundId + 2 - ) - } - await waitForAndExecute(test, 10) - }) -}) diff --git a/integration-tests/test/alt-l2/shared/utils.ts b/integration-tests/test/alt-l2/shared/utils.ts index cfd56a7e06..166f6d8697 100644 --- a/integration-tests/test/alt-l2/shared/utils.ts +++ b/integration-tests/test/alt-l2/shared/utils.ts @@ -26,10 +26,7 @@ export const isLiveNetwork = () => { export const HARDHAT_CHAIN_ID = 31337 export const AVALANCHE_CHAIN_ID = 43112 export const BNB_CHAIN_ID = 99 -export const NON_ETHEREUM_CHAIN = [ - AVALANCHE_CHAIN_ID, - BNB_CHAIN_ID, -] +export const NON_ETHEREUM_CHAIN = [AVALANCHE_CHAIN_ID, BNB_CHAIN_ID] export const DEFAULT_TEST_GAS_L1 = 330_000 export const DEFAULT_TEST_GAS_L2 = 1_300_000 export const ON_CHAIN_GAS_PRICE = 'onchain' @@ -40,7 +37,7 @@ export const L2_BOBA_ADDRESS = predeploys.L2_BOBA_ALT_L1 // The default gas limit for L1 transaction is 9_000_000 export const GAS_LIMIT_OPTION = { 43112: 8_000_000, - 99: 1_000_000, + 99: 8_000_000, } const gasPriceValidator = makeValidator((gasPrice) => { @@ -79,24 +76,24 @@ const env = cleanEnv(process.env, { PRIVATE_KEY: str({ default: - '0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133', + '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80', }), //0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199 GAS_PRICE_ORACLE_PRIVATE_KEY: str({ default: - '0x96b8a38e12e1a31dee1eab2fffdf9d9990045f5b37e44d8cc27766ef294acf18', + '0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e', }), PRIVATE_KEY_2: str({ default: - '0xb9d2ea9a615f3165812e8d44de0d24da9bbd164b65c4f0573e1ce2c8dbd9c8df', + '0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba', }), PRIVATE_KEY_3: str({ default: - '0x96b8a38e12e1a31dee1eab2fffdf9d9990045f5b37e44d8cc27766ef294acf18', + '0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e', }), PRIVATE_KEY_4: str({ default: - '0x96b8a38e12e1a31dee1eab2fffdf9d9990045f5b37e44d8cc27766ef294acf18', + '0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e', }), BOBALINK_PRIVATE_KEY: str({ default: @@ -438,7 +435,8 @@ export const getFilteredLogIndex = async ( (log) => log.topics.length > 0 && log.topics[0] === eventTopic && - (!emitterAddress || log.address.toLowerCase() === emitterAddress.toLowerCase()) + (!emitterAddress || + log.address.toLowerCase() === emitterAddress.toLowerCase()) ) return filteredLogs[0].logIndex diff --git a/ops/docker-compose-bnb-side.yml b/ops/docker-compose-bnb-side.yml index a3e6f6e4bf..86f019b923 100644 --- a/ops/docker-compose-bnb-side.yml +++ b/ops/docker-compose-bnb-side.yml @@ -2,7 +2,7 @@ version: "3" # Account #0 x-deployer_pk: &deployer_pk - DEPLOYER_PRIVATE_KEY: '0x953dbe85f02d84377f90a6eb6d8a6dd128aa50f69c4671d32414b139040be24b' + DEPLOYER_PRIVATE_KEY: '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' # Account #6 - bobalink test x-bobalink_pk: &bobalink_pk @@ -10,7 +10,7 @@ x-bobalink_pk: &bobalink_pk # Account #19 x-gas-price-oracle_pk: &gas-price-oracle_pk - GAS_PRICE_ORACLE_OWNER_PRIVATE_KEY: '0x68ef711b398fa47f22fbc44a972efbd2c2e25338e7c6afb92dc84b569bf784a5' + GAS_PRICE_ORACLE_OWNER_PRIVATE_KEY: '0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e' services: @@ -84,10 +84,10 @@ services: MIN_BALANCE: 0 URL: http://dtl:8081/addresses.json AA_DEPLOYER: http://dtl:8081/aa-addr.json - MNEMONIC_OR_PK: "0x953dbe85f02d84377f90a6eb6d8a6dd128aa50f69c4671d32414b139040be24b" + MNEMONIC_OR_PK: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" L1_NODE_WEB3_URL: http://l1_chain:8545 L2_NODE_WEB3_URL: http://l2geth:8545 - BENEFICIARY: "0xc32ec0115BCB6693d4b4854531cA5e6a99217ABF" + BENEFICIARY: "0xcd3b766ccdd6ae721141f452c550ca635964ce71" MAX_BUNDLE_GAS: 5000000 #should be set to false in prod! UNSAFE: 'true' @@ -132,5 +132,5 @@ services: - "5432:5432" networks: - default: - name: local-network + bnb-network: + name: bnb-network diff --git a/ops/docker-compose-bnb.yml b/ops/docker-compose-bnb.yml index 885c39b362..d21061a610 100644 --- a/ops/docker-compose-bnb.yml +++ b/ops/docker-compose-bnb.yml @@ -1,89 +1,141 @@ # # Accounts and their usage -# Deployer: -#- Address: 0xb75573a04648535Bddc52adf6fBc887149624253 -#- PrivKey: 0x953dbe85f02d84377f90a6eb6d8a6dd128aa50f69c4671d32414b139040be24b - -## Relayer: -#- Address: 0xBb46AbbCC95213754f549E0CFa2B13bef0aBFaB6 -#- PrivKey: 0x4d5211ccb78c977d7ae7094b27b561458274a1c2df8be5f3c66479fe33ea8838 - -## Fast Relayer: -#- Address: 0x8E1Ad6FaC6ea5871140594ABEF5b1D503385e936 -#- PrivKey: 0x3c6efff45290e2204cc19b091cdefffcead5757b074b1723e9cf8973e6337ba4 - -# Integration 2 PK: -#- Address: 0xC8D063A7e0A118432721daE5e059404b5598BD76 -#- PrivKey: 0x81f43b0303746bfacbaae64947850e86deca412d3b39b1f8d3c89bf483d615f3 - -## Integration 3 PK: -#- Address: 0xc32ec0115BCB6693d4b4854531cA5e6a99217ABF -#- PrivKey: 0xeca0930606860b8ae4a7f2b9a56ee62c4e11f613a894810b7642cabef689cf09 - -# GasPrice Oracle -#- Address: 0x7fd60C817837dCFEFCa6D0A52A44980d12F70C59 -#- PrivKey: 0x68ef711b398fa47f22fbc44a972efbd2c2e25338e7c6afb92dc84b569bf784a5 +# l1_chain_1 | Account #0: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (10000 ETH) +# l1_chain_1 | Private Key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 +# l1_chain_1 | +# l1_chain_1 | Account #1: 0x70997970c51812dc3a010c7d01b50e0d17dc79c8 (10000 ETH) +# l1_chain_1 | Private Key: 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d +# l1_chain_1 | +# l1_chain_1 | Account #2: 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc (10000 ETH) +# l1_chain_1 | Private Key: 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a +# l1_chain_1 | +# l1_chain_1 | Account #3: 0x90f79bf6eb2c4f870365e785982e1f101e93b906 (10000 ETH) +# l1_chain_1 | Private Key: 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 +# l1_chain_1 | +# l1_chain_1 | Account #4: 0x15d34aaf54267db7d7c367839aaf71a00a2c6a65 (10000 ETH) +# l1_chain_1 | Private Key: 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a +# l1_chain_1 | +# l1_chain_1 | Account #5: 0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc (10000 ETH) +# l1_chain_1 | Private Key: 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba +# l1_chain_1 | +# l1_chain_1 | Account #6: 0x976ea74026e726554db657fa54763abd0c3a0aa9 (10000 ETH) +# l1_chain_1 | Private Key: 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e +# l1_chain_1 | +# l1_chain_1 | Account #7: 0x14dc79964da2c08b23698b3d3cc7ca32193d9955 (10000 ETH) +# l1_chain_1 | Private Key: 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 +# l1_chain_1 | +# l1_chain_1 | Account #8: 0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f (10000 ETH) +# l1_chain_1 | Private Key: 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 +# l1_chain_1 | +# l1_chain_1 | Account #9: 0xa0ee7a142d267c1f36714e4a8f75612f20a79720 (10000 ETH) +# l1_chain_1 | Private Key: 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 +# l1_chain_1 | +# l1_chain_1 | Account #10: 0xbcd4042de499d14e55001ccbb24a551f3b954096 (10000 ETH) +# l1_chain_1 | Private Key: 0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897 +# l1_chain_1 | +# l1_chain_1 | Account #11: 0x71be63f3384f5fb98995898a86b02fb2426c5788 (10000 ETH) +# l1_chain_1 | Private Key: 0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82 +# l1_chain_1 | +# l1_chain_1 | Account #12: 0xfabb0ac9d68b0b445fb7357272ff202c5651694a (10000 ETH) +# l1_chain_1 | Private Key: 0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1 +# l1_chain_1 | +# l1_chain_1 | Account #13: 0x1cbd3b2770909d4e10f157cabc84c7264073c9ec (10000 ETH) +# l1_chain_1 | Private Key: 0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd +# l1_chain_1 | +# l1_chain_1 | Account #14: 0xdf3e18d64bc6a983f673ab319ccae4f1a57c7097 (10000 ETH) +# l1_chain_1 | Private Key: 0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa +# l1_chain_1 | +# l1_chain_1 | Account #15: 0xcd3b766ccdd6ae721141f452c550ca635964ce71 (10000 ETH) +# l1_chain_1 | Private Key: 0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61 +# l1_chain_1 | +# l1_chain_1 | Account #16: 0x2546bcd3c84621e976d8185a91a922ae77ecec30 (10000 ETH) +# l1_chain_1 | Private Key: 0xea6c44ac03bff858b476bba40716402b03e41b8e97e276d1baec7c37d42484a0 +# l1_chain_1 | +# l1_chain_1 | Account #17: 0xbda5747bfd65f08deb54cb465eb87d40e51b197e (10000 ETH) +# l1_chain_1 | Private Key: 0x689af8efa8c651a91ad287602527f3af2fe9f6501a7ac4b061667b5a93e037fd +# l1_chain_1 | +# l1_chain_1 | Account #18: 0xdd2fd4581271e230360230f9337d5c0430bf44c0 (10000 ETH) +# l1_chain_1 | Private Key: 0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0 +# l1_chain_1 | +# l1_chain_1 | Account #19: 0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199 (10000 ETH) +# l1_chain_1 | Private Key: 0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e ## Account #0 x-deployer_pk: &deployer_pk - DEPLOYER_PRIVATE_KEY: '0x953dbe85f02d84377f90a6eb6d8a6dd128aa50f69c4671d32414b139040be24b' + DEPLOYER_PRIVATE_KEY: '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' +# Account #8 x-relayer_pk: &relayer_pk - RELAYER_PRIVATE_KEY: '0x4d5211ccb78c977d7ae7094b27b561458274a1c2df8be5f3c66479fe33ea8838' + RELAYER_PRIVATE_KEY: '0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97' -# Account #9 +# Account #18 x-fast-relayer_pk: &fast-relayer_pk - FAST_RELAYER_PRIVATE_KEY: '0x3c6efff45290e2204cc19b091cdefffcead5757b074b1723e9cf8973e6337ba4' + FAST_RELAYER_PRIVATE_KEY: '0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0' -# Account #0 - allows the fee test +# Account #19 - allows the fee test x-integration_pk: &integration_pk - PRIVATE_KEY: '0x953dbe85f02d84377f90a6eb6d8a6dd128aa50f69c4671d32414b139040be24b' + PRIVATE_KEY: '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' -# Account #10 - allows the fee test +# Account #14 - allows the fee test x-integration_2_pk: &integration_2_pk - PRIVATE_KEY_2: '0x81f43b0303746bfacbaae64947850e86deca412d3b39b1f8d3c89bf483d615f3' + PRIVATE_KEY_2: '0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa' -# Account #7 - allows the fee test +# Account #15 - allows the fee test x-integration_3_pk: &integration_3_pk - PRIVATE_KEY_3: '0xeca0930606860b8ae4a7f2b9a56ee62c4e11f613a894810b7642cabef689cf09' + PRIVATE_KEY_3: '0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61' -x-integration_4_pk: &integration_4_pk - GAS_PRICE_ORACLE_PRIVATE_KEY: '0x68ef711b398fa47f22fbc44a972efbd2c2e25338e7c6afb92dc84b569bf784a5' +# Account #6 - allows the bobalink test +x-bobalink_pk: &bobalink_pk + BOBALINK_PRIVATE_KEY: '0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e' version: "3" services: + # local bnb somehow doesn't work with circle ci + # l1_chain: + # image: bobanetwork/bnb:bootstrap + # restart: always + # command: ash /scripts/bsc-rpc.sh + # environment: + # NODE_ID: "l1_chain" + # BSC_CHAIN_ID: "99" + # CLUSTER_CIDR: "192.168.0.0/24" + # NETSTATS_URL: "bscpwd@netstats:3000" + # BOOTSTRAP_PUB_KEY: "177ae5db445a2f70db781b019aedd928f5b1528a7a43448840b022408f9a21509adcce0b37c87d59da68d47a16879cc1e95a62bbac9723f7b22f4365b2afabbe" + # BOOTSTRAP_TCP_PORT: 30311 + # VERBOSE: 3 + # ports: + # - '9545:8545' + # networks: + # - bnb-network + + # l1_chain_validator: + # image: bobanetwork/bnb:validator + # restart: always + # command: ash /scripts/bsc-validator.sh + # environment: + # NODE_ID: "l1_chain_validator" + # BOOTSTRAP_HOST: "l1_chain" + # BSC_CHAIN_ID: "99" + # CLUSTER_CIDR: "192.168.0.0/24" + # NETSTATS_URL: "bscpwd@netstats:3000" + # BOOTSTRAP_PUB_KEY: "177ae5db445a2f70db781b019aedd928f5b1528a7a43448840b022408f9a21509adcce0b37c87d59da68d47a16879cc1e95a62bbac9723f7b22f4365b2afabbe" + # BOOTSTRAP_TCP_PORT: 30311 + # VERBOSE: 3 + # networks: + # - bnb-network + + # this is a helper service used because there's no official hardhat image l1_chain: - image: bobanetwork/bnb:bootstrap - restart: always - command: ash /scripts/bsc-rpc.sh + image: bobanetwork/hardhat:latest + build: + context: ./docker/hardhat + dockerfile: Dockerfile environment: - NODE_ID: "l1_chain" - BSC_CHAIN_ID: "99" - CLUSTER_CIDR: "2001:db8:abc1::/64" - NETSTATS_URL: "bscpwd@netstats:3000" - BOOTSTRAP_PUB_KEY: "177ae5db445a2f70db781b019aedd928f5b1528a7a43448840b022408f9a21509adcce0b37c87d59da68d47a16879cc1e95a62bbac9723f7b22f4365b2afabbe" - BOOTSTRAP_TCP_PORT: 30311 - VERBOSE: 3 + CHAIN_ID: 99 + GAS_PRICE: 54321012345 ports: - - '9545:8545' - networks: - - bnb-network - - l1_chain_validator: - image: bobanetwork/bnb:validator - restart: always - command: ash /scripts/bsc-validator.sh - environment: - NODE_ID: "l1_chain_validator" - BOOTSTRAP_HOST: "l1_chain" - BSC_CHAIN_ID: "99" - CLUSTER_CIDR: "2001:db8:abc1::/64" - NETSTATS_URL: "bscpwd@netstats:3000" - BOOTSTRAP_PUB_KEY: "177ae5db445a2f70db781b019aedd928f5b1528a7a43448840b022408f9a21509adcce0b37c87d59da68d47a16879cc1e95a62bbac9723f7b22f4365b2afabbe" - BOOTSTRAP_TCP_PORT: 30311 - VERBOSE: 3 - networks: - - bnb-network + # expose the service to the host for integration testing + - ${L1CHAIN_HTTP_PORT:-9545}:8545 deployer: depends_on: @@ -100,15 +152,15 @@ services: L1_NODE_WEB3_URL: http://l1_chain:8545 # these keys are hardhat's first 2 accounts, DO NOT use in production << : [*deployer_pk, *relayer_pk] - SEQUENCER_ADDRESS: "0xA2bC4Cf857f3D7a22b29c71774B4d8f25cc7edD0" - PROPOSER_ADDRESS: "0x59b02D4d2F94ea5c55230715a58EBb0b703bCD4B" + SEQUENCER_ADDRESS: "0x70997970c51812dc3a010c7d01b50e0d17dc79c8" + PROPOSER_ADDRESS: "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc" # setting the whitelist owner to address(0) disables the whitelist WHITELIST_OWNER: "0x0000000000000000000000000000000000000000" L1_FEE_WALLET_ADDRESS: "0x391716d440c151c42cdf1c95c1d83a5427bca52c" L2_CHAIN_ID: 31338 L2_BLOCK_GAS_LIMIT: 11000000 BLOCK_SIGNER_ADDRESS: "0x00000398232E2064F896018496b4b44b3D62751F" - GAS_PRICE_ORACLE_OWNER: "0x7fd60C817837dCFEFCa6D0A52A44980d12F70C59" + GAS_PRICE_ORACLE_OWNER: "0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199" GAS_PRICE_ORACLE_OVERHEAD: "2750" GAS_PRICE_ORACLE_SCALAR: "1500000" GAS_PRICE_ORACLE_L1_BASE_FEE: "1" @@ -125,8 +177,6 @@ services: ports: # expose the service to the host for getting the contract addrs - ${DEPLOYER_PORT:-8077}:8082 - networks: - - bnb-network boba_deployer: depends_on: @@ -141,7 +191,7 @@ services: environment: L1_NODE_WEB3_URL: http://l1_chain:8545 L2_NODE_WEB3_URL: http://l2geth:8545 - ADDRESS_MANAGER_ADDRESS: "0xC194E4CFa59D2DfC520217dA22E23DF8D4658a37" + ADDRESS_MANAGER_ADDRESS: "0x5FbDB2315678afecb367f032d93F642f64180aa3" URL: http://dtl:8081/addresses.json # DO NOT use in production << : [*deployer_pk, *relayer_pk, *fast-relayer_pk] @@ -150,8 +200,6 @@ services: # skip compilation when run in docker-compose, since the contracts # were already compiled in the builder step NO_COMPILE: 1 - networks: - - bnb-network dtl: depends_on: @@ -185,8 +233,6 @@ services: ports: - ${DTL_PORT:-7878}:7878 - ${REGISTRY_PORT:-8080}:8081 - networks: - - bnb-network l2geth: depends_on: @@ -221,8 +267,6 @@ services: ports: - ${L2GETH_HTTP_PORT:-8545}:8545 - ${L2GETH_WS_PORT:-8546}:8546 - networks: - - bnb-network relayer: depends_on: @@ -250,8 +294,6 @@ services: MAX_WAIT_TX_TIME_S: 5 RESUBMISSION_TIMEOUT: 5 MULTI_RELAY_LIMIT: 5 - networks: - - bnb-network # a second relay system for messages that need to get to L1 quickly # NOTE - all withdrawal messages use the standard relayer with its 7 day window @@ -282,8 +324,6 @@ services: RESUBMISSION_TIMEOUT: 5 MULTI_RELAY_LIMIT: 5 FAST_RELAYER: 'true' - networks: - - bnb-network batch_submitter: restart: always @@ -310,10 +350,8 @@ services: BATCH_SUBMITTER_KMS_ENDPOINT: http://kms:8888/ BATCH_SUBMITTER_KMS_REGION: us-east-1 #aliases are setup, check seed.yml - BATCH_SUBMITTER_SEQUENCER_KEY_ID: "0x91ef3b19cdb344c5010358718e9347dd5cb2f362" - BATCH_SUBMITTER_PROPOSER_KEY_ID: "0xf31ca20d67bf4e3ddb4d7546c4a0983f3fa6ffea" - networks: - - bnb-network + BATCH_SUBMITTER_SEQUENCER_KEY_ID: "0x70997970c51812dc3a010c7d01b50e0d17dc79c8" + BATCH_SUBMITTER_PROPOSER_KEY_ID: "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc" integration_tests: image: bobanetwork/integration-tests:latest @@ -338,11 +376,9 @@ services: NO_NETWORK: 1 L2_CHAINID: 31338 #unfortunately, elsewhere the L2_CHAINID is called CHAIN_ID RETRIES: 500 - << : [*integration_pk, *integration_2_pk, *integration_3_pk, *integration_4_pk] + << : [*integration_pk, *integration_2_pk, *integration_3_pk, *bobalink_pk] volumes: - ~/result:/opt/optimism/integration-tests/result - networks: - - bnb-network replica: depends_on: @@ -379,8 +415,6 @@ services: ports: - ${L2GETH_HTTP_PORT:-8549}:8545 - ${L2GETH_WS_PORT:-8550}:8546 - networks: - - bnb-network verifier: depends_on: @@ -415,8 +449,6 @@ services: ports: - ${VERIFIER_HTTP_PORT:-8547}:8545 - ${VERIFIER_WS_PORT:-8548}:8546 - networks: - - bnb-network fraud-detector: depends_on: @@ -439,8 +471,6 @@ services: L2_START_BLOCK: 1 ports: - ${FRAUD_CHECKER_HTTP_PORT:-8555}:8555 - networks: - - bnb-network #in no way should this be running in production kms: @@ -450,17 +480,11 @@ services: KMS_REGION: "us-east-1" volumes: - type: bind - source: ./seed-bnb.yaml + source: ./seed.yaml target: /init/seed.yaml ports: - 8888:8888 - networks: - - bnb-network networks: bnb-network: - name: local-network - enable_ipv6: true - ipam: - config: - - subnet: "2001:db8:abc1::/64" + name: bnb-network diff --git a/ops/docker/hardhat/hardhat.config.js b/ops/docker/hardhat/hardhat.config.js index 515318a09c..aabcb53073 100644 --- a/ops/docker/hardhat/hardhat.config.js +++ b/ops/docker/hardhat/hardhat.config.js @@ -2,10 +2,12 @@ const isForkModeEnabled = !!process.env.FORK_URL const forkUrl = process.env.FORK_URL const forkStartingBlock = parseInt(process.env.FORK_STARTING_BLOCK) || undefined const gasPrice = parseInt(process.env.GAS_PRICE) || 0 +const chainId = parseInt(process.env.CHAIN_ID) || 31337 const config = { networks: { hardhat: { + chainId, gasPrice, initialBaseFeePerGas: 0 }, diff --git a/packages/boba/gas-price-oracle/test/gas-price-oracle-alt-l1.spec.ts b/packages/boba/gas-price-oracle/test/gas-price-oracle-alt-l1.spec.ts index e212800a83..a7640bd494 100644 --- a/packages/boba/gas-price-oracle/test/gas-price-oracle-alt-l1.spec.ts +++ b/packages/boba/gas-price-oracle/test/gas-price-oracle-alt-l1.spec.ts @@ -857,117 +857,121 @@ describe('gas-price-oracle', () => { await tempGasPriceOracleAltL1Service.init() const input = [-100, 2, 2, 2, 2, 2, 2, 2, 2, 10000] - const filteredOutliers = tempGasPriceOracleAltL1Service.filterOutliers(input) + const filteredOutliers = + tempGasPriceOracleAltL1Service.filterOutliers(input) expect(filteredOutliers.includes(10000)).to.be.eq(false) expect(filteredOutliers.includes(-100)).to.be.eq(false) expect(filteredOutliers.length).to.be.eq(input.length - 2) }) - it('should get Boba and l1 native token prices', async () => { - // Initialize GasPriceOracleAltL1Service - tempGasPriceOracleAltL1Service = new GasPriceOracleAltL1Service({ - l1RpcProvider: ethers.provider, - l2RpcProvider: ethers.provider, - - addressManagerAddress: Lib_AddressManager.address, - gasPriceOracleAddress: gasPriceOracle.address, - - OVM_SequencerFeeVault: address5, - l2_L1NativeTokenAddress: L2SecondaryFeeToken.address, - - gasPriceOracleOwnerWallet: wallet8, - - sequencerAddress: address1, - proposerAddress: address2, - relayerAddress: address3, - fastRelayerAddress: address4, - - pollingInterval: 0, - overheadRatio1000X: 10, - overheadMinPercentChange: 10, - minOverhead: 2000, - minL1BaseFee: 50_000_000_000, - maxL1BaseFee: 100_000_000_000, - bobaFeeRatio100X: 100, - bobaLocalTestnetChainId: 31337, - l1TokenCoinGeckoId: 'moonbeam', - l1TokenCoinMarketCapId: '6836', - // CoinMarketCap free key - coinMarketCapApiKey: '19841722-df8b-493c-b6b3-d7290e4c24d9', - }) - - await tempGasPriceOracleAltL1Service.init() - - /* eslint-disable */ - const BobaPriceFromCoinGecko = - await tempGasPriceOracleAltL1Service._getTokenPriceFromCoinGecko( - 'boba-network' - ) - const l1NativeTokenPriceFromCoinGecko = - await tempGasPriceOracleAltL1Service._getTokenPriceFromCoinGecko( - tempGasPriceOracleAltL1Service.options.l1TokenCoinGeckoId - ) - const BobaPriceFromCoinMarketCap = - await tempGasPriceOracleAltL1Service._getTokenPriceFromCoinMarketCap('14556') - const l1NativeTokenPriceFromCoinMarketCap = - await tempGasPriceOracleAltL1Service._getTokenPriceFromCoinMarketCap( - tempGasPriceOracleAltL1Service.options.l1TokenCoinMarketCapId - ) - /* eslint-enable */ - - expect(BobaPriceFromCoinGecko).not.to.be.equal(0) - expect(l1NativeTokenPriceFromCoinGecko).not.to.be.equal(0) - expect(BobaPriceFromCoinMarketCap).not.to.be.equal(0) - expect(l1NativeTokenPriceFromCoinMarketCap).not.to.be.equal(0) - - await tempGasPriceOracleAltL1Service._updatePriceRatio() - - const decimals = (await Boba_GasPriceOracle.decimals()).toNumber() - const marketPriceRatio = await Boba_GasPriceOracle.marketPriceRatio() - const priceRatio = await Boba_GasPriceOracle.priceRatio() - - /* eslint-disable */ - // calculate the average price of the two sources - const BobaPrice = - (BobaPriceFromCoinGecko - ? BobaPriceFromCoinGecko - : BobaPriceFromCoinMarketCap + BobaPriceFromCoinMarketCap - ? BobaPriceFromCoinMarketCap - : BobaPriceFromCoinGecko) / 2 - const l1NativeTokenPrice = - (l1NativeTokenPriceFromCoinGecko - ? l1NativeTokenPriceFromCoinGecko - : l1NativeTokenPriceFromCoinMarketCap + - l1NativeTokenPriceFromCoinMarketCap - ? l1NativeTokenPriceFromCoinMarketCap - : l1NativeTokenPriceFromCoinGecko) / 2 - /* eslint-enable */ - - const calculatedMarketPriceRatio = Math.round( - (BobaPrice / l1NativeTokenPrice) * 10 ** decimals - ) - const calculatedPriceRatio = Math.round( - (calculatedMarketPriceRatio * - tempGasPriceOracleAltL1Service.options.bobaFeeRatio100X) / - 100 - ) - - /* eslint-disable */ - expect(marketPriceRatio.toNumber()).to.be.gte( - calculatedMarketPriceRatio - 2 - ) - expect(marketPriceRatio.toNumber()).to.be.lte( - calculatedMarketPriceRatio + 2 - ) - expect(priceRatio.toNumber()).to.be.gte(calculatedPriceRatio - 2) - expect(priceRatio.toNumber()).to.be.lte(calculatedPriceRatio + 2) - /* eslint-enable */ - - // Don't update the price ratio if the price is the same - const preBlockNumber = await wallet8.provider.getBlockNumber() - await tempGasPriceOracleAltL1Service._updatePriceRatio() - const postBlockNumber = await wallet8.provider.getBlockNumber() - expect(preBlockNumber).to.be.eq(postBlockNumber) - }) + // Disable this test + // it('should get Boba and l1 native token prices', async () => { + // // Initialize GasPriceOracleAltL1Service + // tempGasPriceOracleAltL1Service = new GasPriceOracleAltL1Service({ + // l1RpcProvider: ethers.provider, + // l2RpcProvider: ethers.provider, + + // addressManagerAddress: Lib_AddressManager.address, + // gasPriceOracleAddress: gasPriceOracle.address, + + // OVM_SequencerFeeVault: address5, + // l2_L1NativeTokenAddress: L2SecondaryFeeToken.address, + + // gasPriceOracleOwnerWallet: wallet8, + + // sequencerAddress: address1, + // proposerAddress: address2, + // relayerAddress: address3, + // fastRelayerAddress: address4, + + // pollingInterval: 0, + // overheadRatio1000X: 10, + // overheadMinPercentChange: 10, + // minOverhead: 2000, + // minL1BaseFee: 50_000_000_000, + // maxL1BaseFee: 100_000_000_000, + // bobaFeeRatio100X: 100, + // bobaLocalTestnetChainId: 31337, + // l1TokenCoinGeckoId: 'moonbeam', + // l1TokenCoinMarketCapId: '6836', + // // CoinMarketCap free key + // coinMarketCapApiKey: '19841722-df8b-493c-b6b3-d7290e4c24d9', + // }) + + // await tempGasPriceOracleAltL1Service.init() + + // /* eslint-disable */ + // const BobaPriceFromCoinGecko = + // await tempGasPriceOracleAltL1Service._getTokenPriceFromCoinGecko( + // 'boba-network' + // ) + // const l1NativeTokenPriceFromCoinGecko = + // await tempGasPriceOracleAltL1Service._getTokenPriceFromCoinGecko( + // tempGasPriceOracleAltL1Service.options.l1TokenCoinGeckoId + // ) + // const BobaPriceFromCoinMarketCap = + // await tempGasPriceOracleAltL1Service._getTokenPriceFromCoinMarketCap( + // '14556' + // ) + // const l1NativeTokenPriceFromCoinMarketCap = + // await tempGasPriceOracleAltL1Service._getTokenPriceFromCoinMarketCap( + // tempGasPriceOracleAltL1Service.options.l1TokenCoinMarketCapId + // ) + // /* eslint-enable */ + + // expect(BobaPriceFromCoinGecko).not.to.be.equal(0) + // expect(l1NativeTokenPriceFromCoinGecko).not.to.be.equal(0) + // expect(BobaPriceFromCoinMarketCap).not.to.be.equal(0) + // expect(l1NativeTokenPriceFromCoinMarketCap).not.to.be.equal(0) + + // await tempGasPriceOracleAltL1Service._updatePriceRatio() + + // const decimals = (await Boba_GasPriceOracle.decimals()).toNumber() + // const marketPriceRatio = await Boba_GasPriceOracle.marketPriceRatio() + // const priceRatio = await Boba_GasPriceOracle.priceRatio() + + // /* eslint-disable */ + // // calculate the average price of the two sources + // const BobaPrice = + // (BobaPriceFromCoinGecko + // ? BobaPriceFromCoinGecko + // : BobaPriceFromCoinMarketCap + BobaPriceFromCoinMarketCap + // ? BobaPriceFromCoinMarketCap + // : BobaPriceFromCoinGecko) / 2 + // const l1NativeTokenPrice = + // (l1NativeTokenPriceFromCoinGecko + // ? l1NativeTokenPriceFromCoinGecko + // : l1NativeTokenPriceFromCoinMarketCap + + // l1NativeTokenPriceFromCoinMarketCap + // ? l1NativeTokenPriceFromCoinMarketCap + // : l1NativeTokenPriceFromCoinGecko) / 2 + // /* eslint-enable */ + + // const calculatedMarketPriceRatio = Math.round( + // (BobaPrice / l1NativeTokenPrice) * 10 ** decimals + // ) + // const calculatedPriceRatio = Math.round( + // (calculatedMarketPriceRatio * + // tempGasPriceOracleAltL1Service.options.bobaFeeRatio100X) / + // 100 + // ) + + // /* eslint-disable */ + // expect(marketPriceRatio.toNumber()).to.be.gte( + // calculatedMarketPriceRatio - 2 + // ) + // expect(marketPriceRatio.toNumber()).to.be.lte( + // calculatedMarketPriceRatio + 2 + // ) + // expect(priceRatio.toNumber()).to.be.gte(calculatedPriceRatio - 2) + // expect(priceRatio.toNumber()).to.be.lte(calculatedPriceRatio + 2) + // /* eslint-enable */ + + // // Don't update the price ratio if the price is the same + // const preBlockNumber = await wallet8.provider.getBlockNumber() + // await tempGasPriceOracleAltL1Service._updatePriceRatio() + // const postBlockNumber = await wallet8.provider.getBlockNumber() + // expect(preBlockNumber).to.be.eq(postBlockNumber) + // }) }) }) diff --git a/packages/boba/subgraph/L1/rollup/config/bobaavax.json b/packages/boba/subgraph/L1/rollup/config/bobaavax.json deleted file mode 100644 index e862b5653e..0000000000 --- a/packages/boba/subgraph/L1/rollup/config/bobaavax.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "network": "avalanche", - "contracts": { - "L1CrossDomainMessenger": { - "address": "0x0fc742332ae6D447d6619D93985Aa288B81CBb0C", - "startBlock": 19286932 - }, - "L1CrossDomainMessengerFast": { - "address": "0x5b6714b7926e6D7e34154C9AC945B489978fA7E7", - "startBlock": 19286932 - }, - "StateCommitmentChain": { - "address": "0x1ef85D873Cf451C8B9a45DbE40b478E991F51210", - "startBlock": 19286932 - }, - "Lib_AddressManager": { - "address": "0x00220f8ce1c4be8436574e575fE38558d85e2E6b", - "startBlock": 19286932 - } - } -} diff --git a/packages/boba/subgraph/L1/rollup/config/bobabase.json b/packages/boba/subgraph/L1/rollup/config/bobabase.json deleted file mode 100644 index f4bbc467a7..0000000000 --- a/packages/boba/subgraph/L1/rollup/config/bobabase.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "network": "mbase", - "contracts": { - "L1CrossDomainMessenger": { - "address": "0x76DB375075F1d5Dcd1D70Fc07F69a5c7b40ab877", - "startBlock": 2798105 - }, - "L1CrossDomainMessengerFast": { - "address": "0xAE8885D3b7937af9480cd7301925a88Dfb0cE9f6", - "startBlock": 2798105 - }, - "StateCommitmentChain": { - "address": "0x5E41Eaac5319CDf336c51969E2F164A686138B28", - "startBlock": 2798105 - }, - "Lib_AddressManager": { - "address": "0xF8d0bF3a1411AC973A606f90B2d1ee0840e5979B", - "startBlock": 2103466 - } - } -} diff --git a/packages/boba/subgraph/L1/rollup/config/bobabeam.json b/packages/boba/subgraph/L1/rollup/config/bobabeam.json deleted file mode 100644 index 64d0288352..0000000000 --- a/packages/boba/subgraph/L1/rollup/config/bobabeam.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "network": "moonbeam", - "contracts": { - "L1CrossDomainMessenger": { - "address": "0x4765f8b50Bbe049045bBA1270dc7A8CDF17165cF", - "startBlock": 1687872 - }, - "L1CrossDomainMessengerFast": { - "address": "0x17d02C3e6cB69225d83d0bADEb0fC09aE735CA3b", - "startBlock": 1687872 - }, - "StateCommitmentChain": { - "address": "0xAD379B1518f50Fc737536D2Ec2c13E4640e228A8", - "startBlock": 1687872 - }, - "Lib_AddressManager": { - "address": "0x564c10A60af35a07f0EA8Be3106a4D81014b21a0", - "startBlock": 1687872 - } - } -} diff --git a/packages/boba/subgraph/L1/rollup/config/bobaopera.json b/packages/boba/subgraph/L1/rollup/config/bobaopera.json deleted file mode 100644 index bd64b421ce..0000000000 --- a/packages/boba/subgraph/L1/rollup/config/bobaopera.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "network": "fantom", - "contracts": { - "L1CrossDomainMessenger": { - "address": "0x64Fca36c52628e40de8684C4C3B5EdB22Fd2eFd9", - "startBlock": 47969835 - }, - "L1CrossDomainMessengerFast": { - "address": "0xC0597ED18446254E4dd0CA5D80eb07D3f2E462cF", - "startBlock": 47969835 - }, - "StateCommitmentChain": { - "address": "0xF764C4f8D2982432239A110Cf6B08e95631cE564", - "startBlock": 47969835 - }, - "Lib_AddressManager": { - "address": "0x4e7325bcf09e091Bb8119258B885D4ef687B7386", - "startBlock": 47969835 - } - } -} diff --git a/packages/boba/subgraph/L1/rollup/config/bobaoperatestnet.json b/packages/boba/subgraph/L1/rollup/config/bobaoperatestnet.json deleted file mode 100644 index ff079de294..0000000000 --- a/packages/boba/subgraph/L1/rollup/config/bobaoperatestnet.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "network": "fantom-testnet", - "contracts": { - "L1CrossDomainMessenger": { - "address": "0xEecAD665ca933eeA4a9a2db600E538c1391930d1", - "startBlock": 9371687 - }, - "L1CrossDomainMessengerFast": { - "address": "0xE5781E5E9CbC67E91DF93eD01E922De30125e491", - "startBlock": 9371687 - }, - "StateCommitmentChain": { - "address": "0x352d964E9aD016f122dc78Afa5164417907E0FaF", - "startBlock": 9371674 - }, - "Lib_AddressManager": { - "address": "0x12ad9f501149D3FDd703cC10c567F416B7F0af8b", - "startBlock": 9371642 - } - } -} diff --git a/packages/boba/subgraph/L1/rollup/config/fuji.json b/packages/boba/subgraph/L1/rollup/config/fuji.json deleted file mode 100644 index 4e02897730..0000000000 --- a/packages/boba/subgraph/L1/rollup/config/fuji.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "network": "fuji", - "contracts": { - "L1CrossDomainMessenger": { - "address": "0x68c19B7FbAe4F8034cf6316b2045ba6aB6978F6b", - "startBlock": 11967644 - }, - "L1CrossDomainMessengerFast": { - "address": "0xBc5249095c890F58C0b75795bd21667eFd123F5F", - "startBlock": 11967644 - }, - "StateCommitmentChain": { - "address": "0x57B9C47F2Ae857005238096486C5B107447dE221", - "startBlock": 11967644 - }, - "Lib_AddressManager": { - "address": "0xcE78de95b85212BC348452e91e0e74c17cf37c79", - "startBlock": 11967644 - } - } -} diff --git a/packages/boba/subgraph/L1/rollup/package.json b/packages/boba/subgraph/L1/rollup/package.json index 675c5cfc40..65b5532623 100644 --- a/packages/boba/subgraph/L1/rollup/package.json +++ b/packages/boba/subgraph/L1/rollup/package.json @@ -4,41 +4,13 @@ "scripts": { "codegen": "graph codegen", "build": "graph build", - "prepare:bobabase:rollup": "mustache config/bobabase.json subgraph.template.rollup.yaml > subgraph.yaml", - "prepare:bobabeam:rollup": "mustache config/bobabeam.json subgraph.template.rollup.yaml > subgraph.yaml", - "prepare:bobaoperatestnet:rollup": "mustache config/bobaoperatestnet.json subgraph.template.rollup.yaml > subgraph.yaml", - "prepare:bobaopera:rollup": "mustache config/bobaopera.json subgraph.template.rollup.yaml > subgraph.yaml", - "prepare:fuji:rollup": "mustache config/fuji.json subgraph.template.rollup.yaml > subgraph.yaml", - "prepare:bobaavax:rollup": "mustache config/bobaavax.json subgraph.template.rollup.yaml > subgraph.yaml", "prepare:bobabnbtestnet:rollup": "mustache config/bobabnbtestnet.json subgraph.template.rollup.yaml > subgraph.yaml", "prepare:bobabnb:rollup": "mustache config/bobabnb.json subgraph.template.rollup.yaml > subgraph.yaml", - "prepare:bobabase:addressManager": "mustache config/bobabase.json subgraph.template.addressManager.yaml > subgraph.yaml", - "prepare:bobabeam:addressManager": "mustache config/bobabeam.json subgraph.template.addressManager.yaml > subgraph.yaml", - "prepare:bobaoperatestnet:addressManager": "mustache config/bobaoperatestnet.json subgraph.template.addressManager.yaml > subgraph.yaml", - "prepare:bobaopera:addressManager": "mustache config/bobaopera.json subgraph.template.addressManager.yaml > subgraph.yaml", - "prepare:fuji:addressManager": "mustache config/fuji.json subgraph.template.addressManager.yaml > subgraph.yaml", - "prepare:bobaavax:addressManager": "mustache config/bobaavax.json subgraph.template.addressManager.yaml > subgraph.yaml", - "prepare:bobabnbtestnet:addressManager": "mustache config/bobabnbtestnet.json subgraph.template.addressManager.yaml > subgraph.yaml", - "prepare:bobabnb:addressManager": "mustache config/bobabnb.json subgraph.template.addressManager.yaml > subgraph.yaml", - "deploy:subgraph:bobabase:rollup": "graph deploy --product hosted-service bobanetwork/bobabase-rollup", - "deploy:subgraph:bobabeam:rollup": "graph deploy --product hosted-service bobanetwork/bobabeam-rollup", - "deploy:subgraph:bobabnbtestnet:rollup": "graph deploy --product hosted-service bobanetwork/bobabnb-tn-rollup", - "deploy:subgraph:bobabnb:rollup": "graph deploy --product hosted-service bobanetwork/bobabnb-rollup", - "deploy:subgraph:bobaoperatestnet:rollup": "graph deploy --product hosted-service bobanetwork/bobaopera-tn-rollup", - "deploy:subgraph:bobaopera:rollup": "graph deploy --product hosted-service bobanetwork/bobaopera-rollup", - "deploy:subgraph:fuji:rollup": "graph deploy --product hosted-service bobanetwork/bobafuji-rollup", - "deploy:subgraph:bobaavax:rollup": "graph deploy --product hosted-service bobanetwork/bobaavax-rollup", - "deploy:subgraph:bobabase:addressManager": "graph deploy --product hosted-service bobanetwork/bobabase-address-manager", - "deploy:subgraph:bobabeam:addressManager": "graph deploy --product hosted-service bobanetwork/bobabeam-address-manager", - "deploy:subgraph:bobaoperatestnet:addressManager": "graph deploy --product hosted-service bobanetwork/bobaopera-tn-address-manager", - "deploy:subgraph:bobaopera:addressManager": "graph deploy --product hosted-service bobanetwork/bobaopera-address-manager", - "deploy:subgraph:fuji:addressManager": "graph deploy --product hosted-service bobanetwork/bobafuji-address-manager", - "deploy:subgraph:bobaavax:addressManager": "graph deploy --product hosted-service bobanetwork/bobaavax-address-manager", - "deploy:subgraph:bobabnbtestnet:addressManager": "graph deploy --product hosted-service bobanetwork/bobabnb-tn-address-manager", - "deploy:subgraph:bobabnb:addressManager": "graph deploy --product hosted-service bobanetwork/bobabnb-address-manager" + "deploy:subgraph:bobabnbtestnet:rollup": "graph deploy --studio boba-bnb-testnet-rollup", + "deploy:subgraph:bobabnb:rollup": "graph deploy --studio boba-bnb-rollup" }, "devDependencies": { - "@graphprotocol/graph-cli": "^0.29.0", + "@graphprotocol/graph-cli": "0.71.2", "@graphprotocol/graph-ts": "^0.26.0" }, "dependencies": { diff --git a/packages/boba/subgraph/L1/rollup/subgraph.template.addressManager.yaml b/packages/boba/subgraph/L1/rollup/subgraph.template.addressManager.yaml deleted file mode 100644 index f2e49ede38..0000000000 --- a/packages/boba/subgraph/L1/rollup/subgraph.template.addressManager.yaml +++ /dev/null @@ -1,24 +0,0 @@ -specVersion: 0.0.2 -schema: - file: ./schema.graphql -dataSources: - - kind: ethereum - name: Lib_AddressManager - network: {{network}} - source: - address: '{{contracts.Lib_AddressManager.address}}' - abi: Lib_AddressManager - startBlock: {{ contracts.Lib_AddressManager.startBlock }} - mapping: - kind: ethereum/events - apiVersion: 0.0.5 - language: wasm/assemblyscript - entities: - - Lib_AddressManager - abis: - - name: Lib_AddressManager - file: ./abis/Lib_AddressManager.json - eventHandlers: - - event: AddressSet(indexed string,address,address) - handler: handleAddressSet - file: ./src/Lib_AddressManagermapping.ts diff --git a/packages/boba/subgraph/L1/rollup/subgraph.template.rollup.yaml b/packages/boba/subgraph/L1/rollup/subgraph.template.rollup.yaml index c60da2f99b..24bd51c579 100644 --- a/packages/boba/subgraph/L1/rollup/subgraph.template.rollup.yaml +++ b/packages/boba/subgraph/L1/rollup/subgraph.template.rollup.yaml @@ -2,6 +2,26 @@ specVersion: 0.0.2 schema: file: ./schema.graphql dataSources: + - kind: ethereum + name: Lib_AddressManager + network: {{network}} + source: + address: '{{contracts.Lib_AddressManager.address}}' + abi: Lib_AddressManager + startBlock: {{ contracts.Lib_AddressManager.startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.5 + language: wasm/assemblyscript + entities: + - Lib_AddressManager + abis: + - name: Lib_AddressManager + file: ./abis/Lib_AddressManager.json + eventHandlers: + - event: AddressSet(indexed string,address,address) + handler: handleAddressSet + file: ./src/Lib_AddressManagermapping.ts - kind: ethereum name: L1CrossDomainMessenger network: {{network}} diff --git a/packages/contracts/src/local-network-config.ts b/packages/contracts/src/local-network-config.ts index 83fe1de88b..45d318e50f 100644 --- a/packages/contracts/src/local-network-config.ts +++ b/packages/contracts/src/local-network-config.ts @@ -1,6 +1,4 @@ -import { - defaultHardhatNetworkHdAccountsConfigParams -} from 'hardhat/internal/core/config/default-config' +import { defaultHardhatNetworkHdAccountsConfigParams } from 'hardhat/internal/core/config/default-config' import { normalizeHardhatNetworkAccountsConfig } from 'hardhat/internal/core/providers/util' export const hardHatLocalTestnet = { @@ -142,40 +140,9 @@ export const AvalancheLocalTestnet = { export const BnbLocalTestnet = { chainID: 99, - accounts: [ - { - privateKey: - '0x953dbe85f02d84377f90a6eb6d8a6dd128aa50f69c4671d32414b139040be24b', - }, - { - privateKey: - '0x4d5211ccb78c977d7ae7094b27b561458274a1c2df8be5f3c66479fe33ea8838', - }, - { - privateKey: - '0x3c6efff45290e2204cc19b091cdefffcead5757b074b1723e9cf8973e6337ba4', - }, - { - privateKey: - '0x81f43b0303746bfacbaae64947850e86deca412d3b39b1f8d3c89bf483d615f3', - }, - { - privateKey: - '0xeca0930606860b8ae4a7f2b9a56ee62c4e11f613a894810b7642cabef689cf09', - }, - { - privateKey: - '0x68ef711b398fa47f22fbc44a972efbd2c2e25338e7c6afb92dc84b569bf784a5', - }, - { - privateKey: - '0xa568b36fca21714f879e3cf157f021a4c5dccd6229ef6e6eee7fb7888193c026', - }, - { - privateKey: - '0xc484de1ef84e998869d59752d1f09bffa161673d54250ea152ec82d684e2f154', - }, - ], + accounts: normalizeHardhatNetworkAccountsConfig( + defaultHardhatNetworkHdAccountsConfigParams + ).slice(0, 20), depositL2Gas: 8_000_000, gasLimitOption: { gasLimit: 1_000_000 }, isLocalAltL1: true, diff --git a/packages/sdk/.env.example b/packages/sdk/.env.example new file mode 100644 index 0000000000..c986e6efa0 --- /dev/null +++ b/packages/sdk/.env.example @@ -0,0 +1,3 @@ +# optional +# This is the API key for Boba Team to access the Graph API +THE_GRAPH_API_KEY= diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 56d77d8dc9..76a898b029 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -59,6 +59,7 @@ "dependencies": { "@bobanetwork/core_contracts": "0.5.13", "@eth-optimism/core-utils": "0.8.1", + "dotenv": "8.6.0", "lodash": "^4.17.21", "merkletreejs": "^0.2.27", "node-fetch": "^2.6.7", diff --git a/packages/sdk/src/utils/contracts.ts b/packages/sdk/src/utils/contracts.ts index dfc02428ec..c54d9d01b3 100644 --- a/packages/sdk/src/utils/contracts.ts +++ b/packages/sdk/src/utils/contracts.ts @@ -266,15 +266,15 @@ export const CONTRACT_ADDRESSES: { // BNB local 99: { l1: { - AddressManager: '0xC194E4CFa59D2DfC520217dA22E23DF8D4658a37', - L1CrossDomainMessenger: '0x8b8656D5d37C3DC620B80817972E0d9a5267761b', - L1CrossDomainMessengerFast: '0x07B43F437c3A13eeb17EF2beBea046e61502151f', - L1StandardBridge: '0x285766B642eAA86b8052817c827E4472cDb3dd18', - StateCommitmentChain: '0x57a243B34F9232515Fa9FD8D4c2daFd611cF1BCA', - CanonicalTransactionChain: '0x3717E342Bc746c01244fb40e47521945091238ce', - BondManager: '0xcF8dDe2accE564024B4b92ef7db81B0e6698F07f', - L1MultiMessageRelayer: '0x90f502229E1fAa70cCf900B2D14595a5C55B3bE8', - L1MultiMessageRelayerFast: '0x64160054BdD6e53915C221cBBfAAbaf1f80c7f20', + AddressManager: '0x5FbDB2315678afecb367f032d93F642f64180aa3', + L1CrossDomainMessenger: '0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f', + L1CrossDomainMessengerFast: '0x4EE6eCAD1c2Dae9f525404De8555724e3c35d07B', + L1StandardBridge: '0x09635F643e140090A9A8Dcd712eD6285858ceBef', + StateCommitmentChain: '0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE', + CanonicalTransactionChain: '0x0B306BF915C4d645ff596e518fAf3F9669b97016', + BondManager: '0x3Aa5ebB10DC797CAC828524e59A333d0A371443c', + L1MultiMessageRelayer: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', + L1MultiMessageRelayerFast: '0x22753E4264FDDc6181dc7cce468904A80a363E44', }, l2: DEFAULT_L2_CONTRACT_ADDRESSES, }, @@ -505,12 +505,12 @@ export const BRIDGE_ADAPTER_DATA: { 99: { Standard: { Adapter: StandardBridgeAdapter, - l1Bridge: '0x285766B642eAA86b8052817c827E4472cDb3dd18', + l1Bridge: '0x09635F643e140090A9A8Dcd712eD6285858ceBef', l2Bridge: predeploys.L2StandardBridge, }, ETH: { Adapter: ETHBridgeAdapter, - l1Bridge: '0x285766B642eAA86b8052817c827E4472cDb3dd18', + l1Bridge: '0x09635F643e140090A9A8Dcd712eD6285858ceBef', l2Bridge: predeploys.L2StandardBridge, }, }, diff --git a/packages/sdk/src/utils/graph.ts b/packages/sdk/src/utils/graph.ts index 77fd92f331..05edf744aa 100644 --- a/packages/sdk/src/utils/graph.ts +++ b/packages/sdk/src/utils/graph.ts @@ -1,74 +1,29 @@ import { ethers } from 'ethers' import fetch from 'node-fetch' +// eslint-disable-next-line @typescript-eslint/no-var-requires +require('dotenv').config() + export const WHITELIST_CHAIN_ID: Array = [ 1287, 1284, 4002, 250, 43113, 43114, 97, 56, ] +const THE_GRAPH_API_KEY = process.env.THE_GRAPH_API_KEY + export const GRAPH_API_URL: any = { - // Bobabase - 1287: { - rollup: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabase-rollup', - // The process of syncing Lib_addressManager is super slow - addressManager: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabase-address-manager', - }, - // Bobabeam - 1284: { - rollup: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabeam-rollup', - // The process of syncing Lib_addressManager is super slow - addressManager: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabeam-address-manager', - }, - // Bobaopera testnet - 4002: { - rollup: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaopera-tn-rollup', - // The process of syncing Lib_addressManager is super slow - addressManager: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaopera-tn-address-manager', - }, - // Bobaopera - 250: { - rollup: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaopera-rollup', - // The process of syncing Lib_addressManager is super slow - addressManager: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaopera-address-manager', - }, - // Avalanche Testnet (fuji) - 43113: { - rollup: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobafuji-rollup', - // The process of syncing Lib_addressManager is super slow - addressManager: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobafuji-address-manager', - }, - // Avalanche Mainnet - 43114: { - rollup: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaavax-rollup', - // The process of syncing Lib_addressManager is super slow - addressManager: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobaavax-address-manager', - }, // BNB Testnet 97: { rollup: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabnb-tn-rollup', - // The process of syncing Lib_addressManager is super slow - addressManager: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabnb-tn-address-manager', + typeof THE_GRAPH_API_KEY !== 'undefined' + ? `https://gateway-arbitrum.network.thegraph.com/api/${THE_GRAPH_API_KEY}/subgraphs/id/DzAc9upeBtED6hAKBCkEUYmVTc5kSd2Cfg3Bw63fd8B4` + : 'https://api.studio.thegraph.com/query/35866/boba-bnb-testnet-rollup/version/latest', }, // BNB Mainnet 56: { rollup: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabnb-rollup', - // The process of syncing Lib_addressManager is super slow - addressManager: - 'https://api.thegraph.com/subgraphs/name/bobanetwork/bobabnb-address-manager', + typeof THE_GRAPH_API_KEY !== 'undefined' + ? `https://gateway-arbitrum.network.thegraph.com/api/${THE_GRAPH_API_KEY}/deployments/id/QmWfzcJBxFaEJ2c5n6ZxjERhmwNpkncrZQnzEyGiKiSFpF` + : `https://api.studio.thegraph.com/query/35866/boba-bnb-rollup/version/latest`, }, } @@ -280,7 +235,7 @@ export const getAddressSetEventsFromGraph = async ( if (!GRAPH_API_URL[chainID]) { return [] } - const response = await fetch(GRAPH_API_URL[chainID].addressManager, { + const response = await fetch(GRAPH_API_URL[chainID].rollup, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/packages/sdk/test/utils/graph.spec.ts b/packages/sdk/test/utils/graph.spec.ts index 48f11054cd..664f0cf5dc 100644 --- a/packages/sdk/test/utils/graph.spec.ts +++ b/packages/sdk/test/utils/graph.spec.ts @@ -10,7 +10,7 @@ describe('subgraph tests', () => { let provider: ethers.providers.Provider beforeEach(async () => { provider = new ethers.providers.JsonRpcProvider( - 'https://rpc.ankr.com/fantom_testnet' + 'https://data-seed-prebsc-2-s2.bnbchain.org:8545' ) }) @@ -18,14 +18,14 @@ describe('subgraph tests', () => { // These two events are from the same block const event_1 = await getRelayedMessageEventsFromGraph( provider, - '0x1ab4456687fc99dbaf42fd88da031754fe13167fbca1922db2989e89151058e7', + '0xeb2f76016d0029df16a0ebc7abba5c4afe2b424b0c0ea3cb1bf5ead5f92bf2d0', false ) expect(event_1).to.have.lengthOf(1) const event_2 = await getRelayedMessageEventsFromGraph( provider, - '0x75cdbb1106a93a5fefb47234c253da860f0114ed64a15f629c6fabb45170b222', + '0x2d2ce68e715e0dae0fef636d67383cdbb976a1624db62ebc2ee0d892228f30f4', false ) expect(event_1).to.have.lengthOf(1) @@ -36,7 +36,7 @@ describe('subgraph tests', () => { it('should get transaction and transaction receipt from event', async () => { const event = await getRelayedMessageEventsFromGraph( provider, - '0x1ab4456687fc99dbaf42fd88da031754fe13167fbca1922db2989e89151058e7', + '0xeb2f76016d0029df16a0ebc7abba5c4afe2b424b0c0ea3cb1bf5ead5f92bf2d0', false ) const transactionReceipt = await event[0].getTransactionReceipt() @@ -48,13 +48,13 @@ describe('subgraph tests', () => { it('should get AddressSet events', async () => { provider = new ethers.providers.JsonRpcProvider( - 'https://api.avax-test.network/ext/bc/C/rpc' + 'https://data-seed-prebsc-2-s2.bnbchain.org:8545' ) const event = await getAddressSetEventsFromGraph( provider, - 'L2CrossDomainMessenger', - 11967648, - 11967648 + 'L2ERC1155Bridge', + 30863106, + 30863106 ) expect(event).to.have.lengthOf(1) diff --git a/yarn.lock b/yarn.lock index 64f69539ae..99670fa8b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8163,6 +8163,11 @@ dotenv@8.2.0: resolved "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz" integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw== +dotenv@8.6.0, dotenv@^8.2.0, dotenv@^8.6.0: + version "8.6.0" + resolved "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz" + integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g== + dotenv@^10.0.0: version "10.0.0" resolved "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz" @@ -8183,11 +8188,6 @@ dotenv@^16.0.3: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== -dotenv@^8.2.0, dotenv@^8.6.0: - version "8.6.0" - resolved "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz" - integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g== - dotenv@^9.0.0: version "9.0.2" resolved "https://registry.npmjs.org/dotenv/-/dotenv-9.0.2.tgz"