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

feat: Gas consumption script #1029

Closed
wants to merge 8 commits into from
Closed

Conversation

evan-forbes
Copy link
Member

@evan-forbes evan-forbes commented Nov 17, 2022

Overview

This PR adds a test suite that we can use to measure the gas consumed by standard txs and modifies the network tests so that we can use custom genesis parameters. We still have to add more tx types and some visualization would be nice.

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

@evan-forbes evan-forbes added T:investigate testing items that are strictly related to adding or extending test coverage labels Nov 17, 2022
@evan-forbes evan-forbes added this to the Q4 2022 milestone Nov 17, 2022
@evan-forbes evan-forbes self-assigned this Nov 17, 2022
@evan-forbes evan-forbes changed the title Evan/gas consume script feat: Gas consumption script Nov 17, 2022
Comment on lines +178 to +180
for i := 0; i < 300; i++ {
accounts = append(accounts, tmrand.Str(9))
}
Copy link
Member

Choose a reason for hiding this comment

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

Append re-allocates memory. So it is more memory performant to initialize the slice and then fill it.

size := 300
accounts = make([]string, 0, size)
for i:=0; i<size; i++ {
  accounts[i] = tmrand.Str(9)
}

Copy link
Member Author

Choose a reason for hiding this comment

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

thx for the reminder, we actually have a linter for this but I'm not sure why it didn't get hit

// inside the client.Context, then broadcasts it synchronously.
func SignAndBroadcastTx(encCfg encoding.Config, c Context, account string, msg ...sdk.Msg) (res *sdk.TxResponse, err error) {
opts := []types.TxBuilderOption{
types.SetGasLimit(1000000000000000000),
Copy link
Member

Choose a reason for hiding this comment

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

probably worth a default const.

@evan-forbes
Copy link
Member Author

this is still a draft, and is not worth reviewing atm

@evan-forbes
Copy link
Member Author

created a few plots using data collected using the test here
gas_investigation.pdf

evan-forbes added a commit that referenced this pull request Nov 18, 2022
## Overview

We need to be able to modify the genesis state when using the testnode.
This PR refactors the testnode to allow for that. It also includes a
helper function that handles creation of this genesis state and simplify
the process of starting an in process node.

closes #1037 
part of/blocking #658 
spun out of and blocking #1029 

## Checklist

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords

Co-authored-by: Rootul P <rootulp@gmail.com>
@evan-forbes
Copy link
Member Author

We very likely won't run this test to trace the gas consumption very often, and there is quite a bit of code, so we should just keep them in their own repo.

The only thing this PR should do is enable the investigations to be ran by including the gas consumption monitoring logic imo

@evan-forbes evan-forbes removed this from the Q4 2022 milestone Dec 8, 2022
@evan-forbes
Copy link
Member Author

closing this, as we don't have plans on merging

@evan-forbes evan-forbes closed this Jan 3, 2023
@rootulp rootulp deleted the evan/gas-consume-script branch July 23, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing items that are strictly related to adding or extending test coverage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants