Skip to content

Commit

Permalink
fix: use bor_getAuthor instead of block.miner to fetch block miner (#151
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Raneet10 authored Feb 8, 2023
1 parent d0802ad commit 0aea961
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ STRESS_DEBUG_LOGS=false# boolean flag to enable debug logs for the stress tests
BURN_CONTRACT_ADDRESS=0x000000000000000000000000000000000000dead# Burn contract address
MAX_FEE=30000000009# Max fee per gas
MAX_PRIORITY_FEE=30000000000# Max priority fee per gas
COUNT=100# Number of times to execute the test
COUNT=10# Number of times to execute the test
23 changes: 18 additions & 5 deletions tests/test-eip-1559.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ async function runTest(web3, accounts, sender) {
const burnContract = process.env.BURN_CONTRACT_ADDRESS

const latestBlock = await web3.eth.getBlock('latest')
let miner = latestBlock.miner
console.log('Coinbase account: ', miner)
let miner = await web3.eth.getAuthor(latestBlock.number)
console.log('Block miner: ', miner)

const maxPriorityFeePerGas = process.env.MAX_PRIORITY_FEE
const maxFeePerGas = process.env.MAX_FEE
Expand Down Expand Up @@ -84,8 +84,9 @@ async function runTest(web3, accounts, sender) {
const blockBaseFeePerGas = block.baseFeePerGas

// In case a new sprint begins, block miner will change
if (block.miner !== miner) {
miner = block.miner
const blockMiner = await web3.eth.getAuthor(block.number)
if (blockMiner !== miner) {
miner = blockMiner
const prevBlock = await web3.eth.getBlock(block.number - 1)
initialMinerBal = await web3.eth.getBalance(miner, prevBlock.number)
}
Expand Down Expand Up @@ -151,7 +152,19 @@ async function initWeb3(machine) {
providerOrUrl: `http://${machine}:8545`
})

return new Web3(provider)
const web3 = new Web3(provider)
web3.extend({
property: 'eth',
methods: [
{
name: 'getAuthor',
call: 'bor_getAuthor',
params: 1,
inputFormatter: [web3.extend.utils.toHex]
}
]
})
return web3
}

export async function testEip1559(n) {
Expand Down

0 comments on commit 0aea961

Please sign in to comment.