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

[Feature] Adding loadbot ERC20 and ERC721 token transfer mode #425

Merged
merged 40 commits into from
Mar 30, 2022

Conversation

ZeljkoBenovic
Copy link
Contributor

@ZeljkoBenovic ZeljkoBenovic commented Feb 18, 2022

Description

This PR adds the ERC20 and ERC721 token transactions feature to the loadbot.
It will deploy a new ERC20 or ERC721 SC to the network and make ERC20 or ERC721 token or mint transactions.
New --mode erc20 and --mode erc721 switches are implemented.
The loadbot output now shows gas related metrics ( gasLimit and gasUsed) and the derived block utilization.

Fixes EDGE-452

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Manual tests

Pull branch and run the loadbot with new mode switch. For example:
go run main.go loadbot --mode erc20 --jsonrpc http://127.0.0.1:40001 --grpc-address 127.0.0.1:30001 --sender 0x228466F2C715CbEC05dEAbfAc040ce3619d7CF0B --receiver 0xca48694ebcB2548dF5030372BE4dAad694ef174e --count 50 --value 0x101 --tps 200

Documentation update

Updated docs 0xPolygon/polygon-edge-docs#68

Additional comments

Before running the loadbot env vars with acc/keys need to be set:
export LOADBOT_<account address>=<account private key>

* Added new flag option for erc20 transfers
* Added deployContract function
* Added the option to pass parameters to smart contract constructor
* Changed executeTxn method to support multiple transaction mods
* Added Contract Deployment metrics to the output
* Added gasLimit metric
* Added percentual gas usage metric
* Increased receipt timeout
* Added condition to show contract deploy metrics
@ZeljkoBenovic ZeljkoBenovic added the feature New update to Polygon Edge label Feb 18, 2022
@ZeljkoBenovic ZeljkoBenovic self-assigned this Feb 18, 2022
Copy link
Contributor

@Kourin1996 Kourin1996 left a comment

Choose a reason for hiding this comment

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

Can you add "erc20" in the description of mode argument in loadbot command?

command/loadbot/execution.go Outdated Show resolved Hide resolved
dbrajovic and others added 10 commits March 1, 2022 14:01
* Remove unnessesary print line
* Decrese the token transfer amount
* Moved SetContractAddress to TransactionGenerator
* Moved contractAddress to BaseGenerator
* Removed/added comments
* Renamed transactions.go to deploy_contract.go
* Pleased linter gods
* Added max-wait flag for custom time to wait for receipts
@ZeljkoBenovic ZeljkoBenovic marked this pull request as ready for review March 2, 2022 21:15
@0xAleksaOpacic 0xAleksaOpacic changed the title [Feature] Adding loadbot ERC20 token transfer mode [Feature] Adding loadbot ERC20 and ERC721 token transfer mode Mar 3, 2022
Copy link
Contributor

@dbrajovic dbrajovic left a comment

Choose a reason for hiding this comment

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

LGTM, apart from a few interfaces/structs which should be refactored (in a separate PR).

Copy link
Contributor

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

I've left some comments that need to be addressed.

The PR looks good, but there are a few problematic parts that worry me, namely how we merged the Transaction generator and contract / token generator logic, and why we removed dynamic wait times for transactions.

Please review the comments and we can discuss 🙏

* set more detailed err output in initContractAndArgs method
* run this method only if any erc mode is set
…etrics

* output contract block details only if any erc mode was selected
* added hasValidDeployParams
* added configurable receipt timeout max-wait
* moved contract metrics to dedicated struct
* deploy contract only if isTokenTransferMode is true
…ator

* created new ContractTxnGenerator interface
* prettyfied erc20abi json
* created dedicated method for initializing blocks map
* dynamicaly set txn or tokenTxn generator
Copy link
Contributor

@Kourin1996 Kourin1996 left a comment

Choose a reason for hiding this comment

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

Looks good to me. I have one question. Please check it.

command/loadbot/generator/erc_generators.go Show resolved Hide resolved
Copy link
Contributor

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

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

Thank you for resolving the discussions 🙏

Looks good 💯

@zivkovicmilos zivkovicmilos linked an issue Mar 28, 2022 that may be closed by this pull request
* added erc20 total token supply value description
* lowered value for erc20 token transfers
Copy link
Contributor

@0xAleksaOpacic 0xAleksaOpacic left a comment

Choose a reason for hiding this comment

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

LGTM!

@ZeljkoBenovic ZeljkoBenovic merged commit f59d3ca into develop Mar 30, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2022
@zivkovicmilos zivkovicmilos deleted the feature/loadbot_erc20 branch April 2, 2022 14:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New update to Polygon Edge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LoadBot fails with SIGSEGV
5 participants