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

Transaction input and data refactors #6294

Merged
merged 15 commits into from
Aug 3, 2023
Merged

Conversation

spacesailor24
Copy link
Contributor

@spacesailor24 spacesailor24 commented Jul 19, 2023

closes #6183

@spacesailor24 spacesailor24 added the 4.x 4.0 related label Jul 19, 2023
@spacesailor24 spacesailor24 self-assigned this Jul 19, 2023
@github-actions
Copy link

github-actions bot commented Jul 19, 2023

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

Asset Old size New size Diff Diff %
Total 652 KB 652 KB 214 bytes 0.03%
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset Old size New size Diff Diff %
web3.min.js 635 KB 635 KB 214 bytes 0.03%
../lib/commonjs/index.d.ts 8.56 KB 8.56 KB 0 0.00%
../lib/commonjs/accounts.d.ts 3.67 KB 3.67 KB 0 0.00%
../lib/commonjs/types.d.ts 2.45 KB 2.45 KB 0 0.00%
../lib/commonjs/web3.d.ts 1.14 KB 1.14 KB 0 0.00%
../lib/commonjs/abi.d.ts 1000 bytes 1000 bytes 0 0.00%
../lib/commonjs/eth.exports.d.ts 280 bytes 280 bytes 0 0.00%
../lib/commonjs/providers.exports.d.ts 148 bytes 148 bytes 0 0.00%
../lib/commonjs/version.d.ts 60 bytes 60 bytes 0 0.00%

@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Merging #6294 (d82de1a) into 4.x (0ee9bb4) will decrease coverage by 0.03%.
The diff coverage is 90.47%.

Additional details and impacted files
@@            Coverage Diff             @@
##              4.x    #6294      +/-   ##
==========================================
- Coverage   88.89%   88.86%   -0.03%     
==========================================
  Files         199      199              
  Lines        7706     7707       +1     
  Branches     2115     2120       +5     
==========================================
- Hits         6850     6849       -1     
- Misses        856      858       +2     
Flag Coverage Δ
UnitTests 88.86% <90.47%> (-0.03%) ⬇️

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 ∅ <ø> (∅)

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jul 19, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: d82de1a
Status: ✅  Deploy successful!
Preview URL: https://3e9f707b.web3-js-docs.pages.dev
Branch Preview URL: https://wyatt-4-x-6183-input-data-re.web3-js-docs.pages.dev

View logs

@@ -42,7 +42,7 @@ const getEthereumjsTxDataFromTransaction = (
gasLimit: transaction.gasLimit ?? transaction.gas,
to: transaction.to,
value: transaction.value,
data: transaction.input,
data: transaction.data ?? transaction.input,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The property name is still data because that's what TransactionFactory.fromTxData is expecting

Comment on lines +412 to +413
input?: Bytes;
data?: Bytes;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a breaking change for eth_types, but input won't be apart of this object if the user uses data

@luu-alex
Copy link
Contributor

LGTM needs a changelog update

@avkos avkos self-requested a review July 24, 2023 16:29
@Muhammad-Altabba Muhammad-Altabba self-requested a review July 25, 2023 16:29
transactionSchema,
options: {
transactionSchema?: ValidationSchemaInput | typeof transactionSchema;
fillInputAndData?: boolean;
Copy link
Contributor Author

@spacesailor24 spacesailor24 Jul 28, 2023

Choose a reason for hiding this comment

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

A new parameter, fillInputAndData, was added to the options argument for formatTransaction. This method is used for formatting both user submitted and RPC response transaction objects. So, we need a flag to determine whether to leave the transaction object as given, or fill in the input or data properties if they weren't present. The fillInputAndData option is set in rpc_method_wrappers.ts for relevant methods

Copy link
Contributor

Choose a reason for hiding this comment

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

This, and things similar, needs to be in the documentation.

@spacesailor24 spacesailor24 removed their assignment Jul 28, 2023
@spacesailor24
Copy link
Contributor Author

@Muhammad-Altabba Need your re-review

Copy link
Contributor

@Muhammad-Altabba Muhammad-Altabba left a comment

Choose a reason for hiding this comment

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

Good job!
All good now I think.
However, the documentation needs to be updated accordingly.

transactionSchema,
options: {
transactionSchema?: ValidationSchemaInput | typeof transactionSchema;
fillInputAndData?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

This, and things similar, needs to be in the documentation.

@jdevcs jdevcs merged commit 51d087e into 4.x Aug 3, 2023
67 checks passed
@jdevcs jdevcs deleted the wyatt/4.x/6183-input-data-refactor branch August 3, 2023 14:57
This was referenced Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

input parameter added when calling estimateGas for a specific contract call in v4.0.1
5 participants