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

6801 Fill gas price when baseFeePerGas==='0x0' #7050

Merged
merged 9 commits into from
May 22, 2024
Merged

Conversation

avkos
Copy link
Contributor

@avkos avkos commented May 21, 2024

Description

Please include a summary of the changes and be sure to follow our Contribution Guidelines.

Fixes #6801

BSC chain returns baseFeePerGas==='0x0' but supports type 2 transactions.
Fix is set current gasPrice to maxPriorityFeePerGas and maxFeePerGas

const contract = new web3.eth.Contract(ERC20TokenAbi, '0x63C872fC0Add8129F3d18f7975aCbD335356e2aE')
const res = await contract.methods
        .transfer('0x8f3e9c1Bd65EB267d19B176A73217524DC21A5ca', 1)
        .send({
            from: acc.address,
        });
console.log(res);
{
  blockHash: '0x8cd5b444a0d556fea0c94c27dd596dd445a41768dde4a9efee0ed37d01f0ad5b',
  blockNumber: 40514564n,
  cumulativeGasUsed: 364295n,
  effectiveGasPrice: 5050000000n,
  from: '0xe4beef667408b99053dc147ed19592ada0d77f59',
  gasUsed: 52321n,
  logs: [
    {
      address: '0x63c872fc0add8129f3d18f7975acbd335356e2ae',
      topics: [Array],
      data: '0x0000000000000000000000000000000000000000000000000000000000000001',
      blockNumber: 40514564n,
      transactionHash: '0x0cc26c683e87e4c1792fb00de8fd8748e171d0c3e279b63731664dcdefaa6b60',
      transactionIndex: 2n,
      blockHash: '0x8cd5b444a0d556fea0c94c27dd596dd445a41768dde4a9efee0ed37d01f0ad5b',
      logIndex: 1n,
      removed: false
    }
  ],
  logsBloom: '0x00000000000000000000000000000000000000000000040000000000000000000000000000000010000000000000000000200000000004000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000100000000020000000000000',
  status: 1n,
  to: '0x63c872fc0add8129f3d18f7975acbd335356e2ae',
  transactionHash: '0x0cc26c683e87e4c1792fb00de8fd8748e171d0c3e279b63731664dcdefaa6b60',
  transactionIndex: 2n,
  type: 2n,
  events: {
    Transfer: {
      address: '0x63c872fc0add8129f3d18f7975acbd335356e2ae',
      topics: [Array],
      data: '0x0000000000000000000000000000000000000000000000000000000000000001',
      blockNumber: 40514564n,
      transactionHash: '0x0cc26c683e87e4c1792fb00de8fd8748e171d0c3e279b63731664dcdefaa6b60',
      transactionIndex: 2n,
      blockHash: '0x8cd5b444a0d556fea0c94c27dd596dd445a41768dde4a9efee0ed37d01f0ad5b',
      logIndex: 1n,
      removed: false,
      returnValues: [Object],
      event: 'Transfer',
      signature: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
      raw: [Object]
    }
  }
}

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run lint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:coverage and my test cases cover all the lines and branches of the added code.
  • I ran npm run build and tested dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.
  • I have linked Issue(s) with this PR in "Linked Issues" menu.

Copy link

github-actions bot commented May 21, 2024

Bundle Stats

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
10 625.39 kB → 625.57 kB (+180 B) +0.03%
Changeset
File Δ Size
../web3-eth/lib/commonjs/utils/get_transaction_gas_pricing.js 📈 +404 B (+8.70%) 4.53 kB → 4.93 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
web3.min.js 606.1 kB → 606.28 kB (+180 B) +0.03%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
../lib/commonjs/index.d.ts 8.69 kB 0%
../lib/commonjs/accounts.d.ts 3.89 kB 0%
../lib/commonjs/types.d.ts 2.67 kB 0%
../lib/commonjs/web3.d.ts 1.35 kB 0%
../lib/commonjs/web3_eip6963.d.ts 1.2 kB 0%
../lib/commonjs/abi.d.ts 999 B 0%
../lib/commonjs/eth.exports.d.ts 280 B 0%
../lib/commonjs/providers.exports.d.ts 183 B 0%
../lib/commonjs/version.d.ts 60 B 0%

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 2cec997 Previous: e0fc158 Ratio
processingTx 8934 ops/sec (±4.47%) 9220 ops/sec (±3.39%) 1.03
processingContractDeploy 39026 ops/sec (±7.25%) 37127 ops/sec (±6.27%) 0.95
processingContractMethodSend 19250 ops/sec (±4.77%) 19169 ops/sec (±7.11%) 1.00
processingContractMethodCall 37608 ops/sec (±5.93%) 37740 ops/sec (±5.81%) 1.00
abiEncode 42743 ops/sec (±6.34%) 42093 ops/sec (±6.98%) 0.98
abiDecode 29826 ops/sec (±8.29%) 28578 ops/sec (±7.99%) 0.96
sign 1559 ops/sec (±3.49%) 1542 ops/sec (±0.87%) 0.99
verify 364 ops/sec (±0.55%) 360 ops/sec (±0.57%) 0.99

This comment was automatically generated by workflow using github-action-benchmark.

Copy link

codecov bot commented May 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.01%. Comparing base (4358140) to head (b7e6d96).
Report is 246 commits behind head on 4.x.

Current head b7e6d96 differs from pull request most recent head 2cec997

Please upload reports for the commit 2cec997 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##              4.x    #7050      +/-   ##
==========================================
+ Coverage   87.37%   92.01%   +4.63%     
==========================================
  Files         197      215      +18     
  Lines        7548     8300     +752     
  Branches     2059     2282     +223     
==========================================
+ Hits         6595     7637    +1042     
+ Misses        953      663     -290     
Flag Coverage Δ
UnitTests 92.01% <100.00%> (+4.63%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
web3 ∅ <ø> (∅)
web3-core ∅ <ø> (∅)
web3-errors ∅ <ø> (∅)
web3-eth ∅ <ø> (∅)
web3-eth-abi ∅ <ø> (∅)
web3-eth-accounts ∅ <ø> (∅)
web3-eth-contract ∅ <ø> (∅)
web3-eth-ens ∅ <ø> (∅)
web3-eth-iban ∅ <ø> (∅)
web3-eth-personal ∅ <ø> (∅)
web3-net ∅ <ø> (∅)
web3-providers-http ∅ <ø> (∅)
web3-providers-ipc ∅ <ø> (∅)
web3-providers-ws ∅ <ø> (∅)
web3-rpc-methods ∅ <ø> (∅)
web3-utils ∅ <ø> (∅)
web3-validator ∅ <ø> (∅)

@avkos avkos changed the title 6801 Fill 6801 Fill gas price May 21, 2024
@avkos avkos changed the title 6801 Fill gas price 6801 Fill gas price when baseFeePerGas==='0x0' May 21, 2024
Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changelog update, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fillGasPrice fundamentally changed transactions, should have been a breaking change?
3 participants