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

Add max mint gas tests #512

Merged
merged 3 commits into from
Mar 9, 2023
Merged

Add max mint gas tests #512

merged 3 commits into from
Mar 9, 2023

Conversation

ryley-o
Copy link
Contributor

@ryley-o ryley-o commented Mar 7, 2023

Description of the change

Add some tests to better quantify maximum gas used when performing purchase transactions.

Note that these are quickly added tests to help describe maximum gas expected when minting, but they by no means represent maximum possible gas.

The following items could increase gas to an unbounded amount:

  • Transfers of payment to additional payee would add more gas to purchase transactions
  • Any payee implementing a receive() or fallback() function can perform an arbitrary amount of execution during a purchase transaction, making purchase transaction gas costs unbounded.

The logs associated with the new tests are:

  GenArt721CoreV3 Gas Tests
    mint gas optimization
max gas used for all tested mints: 114731
average gas used for mint optimization test: 111911
=USD at 100gwei, $2k USD/ETH: $22.3822
      ✓ test gas cost of mint on MinterSetPrice [ @skip-on-coverage ]
max gas used for all tested mints: 114891
average gas used for mint optimization test: 112071
=USD at 100gwei, $2k USD/ETH: $22.414199999999997
      ✓ test gas cost of mint on MinterSetPriceERC20 [ @skip-on-coverage ]
max gas used for all tested mints: 124132
average gas used for mint optimization test: 121312
=USD at 100gwei, $2k USD/ETH: $24.2624
      ✓ test gas cost of mint on MinterDAExp [ @skip-on-coverage ]
max gas used for all tested mints: 137508
average gas used for mint optimization test: 105602
=USD at 100gwei, $2k USD/ETH: $21.1204
      ✓ test gas cost of mint on MinterDAExpSettlement [ @skip-on-coverage ]
max gas used for all tested mints: 124237
average gas used for mint optimization test: 121417
=USD at 100gwei, $2k USD/ETH: $24.2834
      ✓ test gas cost of mint on MinterDALin [ @skip-on-coverage ]
max gas used for all tested mints: 146006
average gas used for mint optimization test: 130247
=USD at 100gwei, $2k USD/ETH: $26.0494
      ✓ test gas cost of mint on MinterMerkle [ @skip-on-coverage ]
max gas used for all tested mints: 121354
average gas used for mint optimization test: 118534
=USD at 100gwei, $2k USD/ETH: $23.7068
      ✓ test gas cost of mint on MinterHolder [ @skip-on-coverage ]
max gas used for all tested mints: 146016
average gas used for mint optimization test: 130056
=USD at 100gwei, $2k USD/ETH: $26.011200000000002
      ✓ test gas cost of mint on MinterMerkle [ @skip-on-coverage ]
max gas used for all tested mints: 118333
average gas used for mint optimization test: 118333
=USD at 100gwei, $2k USD/ETH: $23.6666
      ✓ test gas cost of mint on MinterHolder [ @skip-on-coverage ]

Conclusion

It seams reasonable to update the frontend to use a hard-coded upper limit of 250k gas based on the data above. That provides a margin of 250/146 = ~+70% relative to the max observed Merkle minter purchase gas to account for additional payee splits, etc.

@ryley-o ryley-o requested a review from a team as a code owner March 7, 2023 19:11
@ryley-o ryley-o requested a review from jakerockland March 7, 2023 19:11
@ryley-o ryley-o self-assigned this Mar 7, 2023
@ryley-o ryley-o requested a review from Asupkay March 7, 2023 19:11
@ryley-o ryley-o enabled auto-merge March 9, 2023 05:57
@ryley-o ryley-o merged commit 3169f5e into main Mar 9, 2023
@ryley-o ryley-o deleted the add-max-gas-tests branch March 9, 2023 06:02
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.

2 participants