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

Mandos test benchmarking #3527

Merged
merged 25 commits into from
Jan 25, 2022
Merged

Mandos test benchmarking #3527

merged 25 commits into from
Jan 25, 2022

Conversation

andrei-diaconescu
Copy link
Contributor

@andrei-diaconescu andrei-diaconescu commented Oct 21, 2021

  • added mandos test benchmarking

@codecov
Copy link

codecov bot commented Oct 21, 2021

Codecov Report

Merging #3527 (9e8e91a) into development (bbcfef9) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##           development    #3527   +/-   ##
============================================
  Coverage        73.78%   73.78%           
============================================
  Files              589      589           
  Lines            76218    76218           
============================================
+ Hits             56237    56241    +4     
+ Misses           15532    15530    -2     
+ Partials          4449     4447    -2     
Impacted Files Coverage Δ
process/economics/economicsData.go 71.18% <ø> (ø)
p2p/libp2p/netMessenger.go 75.27% <0.00%> (+0.55%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4b3aa9...9e8e91a. Read the comment docs.

@andrei-diaconescu andrei-diaconescu changed the base branch from master to development October 21, 2021 12:21
account.SetCode(accountCode)
ownerAddress := mandosAcc.GetOwner()
account.SetOwnerAddress(ownerAddress)
account.SetCodeMetadata([]byte{0, 0})
Copy link
Contributor

Choose a reason for hiding this comment

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

Does mandosAcc contain code metadata to use here instead of 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, mandos does not yet support code metadata as far as I know

for i, mandosTx := range mandosTxs {
if bytes.Equal(mandosTx.GetReceiverAddress(), addressToBeReplaced) {
mandosTx.WithReceiverAddress(deployedScAddress)
mandosTxs[i] = mandosTx
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this line necessary?

}

// DeploySCsFromMandosDeployTxs deploys all smartContracts correspondent to "scDeploy" in a mandos test, then replaces with the correct computed address in all the transactions.
func DeploySCsFromMandosDeployTxs(testContext *vm.VMTestContext, deployMandosTxs []*mge.Transaction, mandosTxs []*mge.Transaction, deployedScAccounts []*mge.TestAccount) (err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider splitting this function in two, separating the tasks of (1) deploying the SCs and collecting their new addresses and then (2) injecting the new addresses in the Mandos transactions that need to call the newly deployed SCs. As it is, the function is somewhat opaque and it's not clear whether it does what the author intended.

transactions = make([]*transaction.Transaction, 0)
for _, mandosTx := range mandosTxs {
gasLimit, gasPrice := mandosTx.GetGasLimitAndPrice()
var data []byte
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this line at the top of the function.

codeHash := account.GetCodeHash()
code := accAdapter.GetCode(codeHash)
require.Equal(t, len(mandosAcc.GetCode()), len(code))

Copy link
Contributor

Choose a reason for hiding this comment

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

If the mandosAcc contains CodeMetadata, it should be asserted here as well against the CodeMetadata in accHandler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I know, CodeMetadata is currently not available in mandos

}
defer testContext.Close()
if benchmarkTxPos == mge.InvalidBenchmarkTxPos {
fmt.Println("There is not benchmark to be made")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Println("There is not benchmark to be made")
fmt.Println("no transactions marked for benchmarking")

func BenchmarkMandosSpecificTx(b *testing.B, mandosTestPath string) {
testContext, transactions, benchmarkTxPos, err := SetStateFromMandosTest(mandosTestPath)
if err != nil {
fmt.Println("Setting state went wrong: ", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using the logger instead of fmt.Println().

camilbancioiu
camilbancioiu previously approved these changes Nov 26, 2021
sasurobert
sasurobert previously approved these changes Dec 28, 2021
@andrei-diaconescu andrei-diaconescu marked this pull request as ready for review December 28, 2021 09:47
@@ -0,0 +1,185 @@
package mandosConverter
Copy link
Contributor

Choose a reason for hiding this comment

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

mandosConverterUtils :| - not quite happy with the naming

@iulianpascalau iulianpascalau merged commit fac376d into development Jan 25, 2022
@iulianpascalau iulianpascalau deleted the mandos-test-benchmarking branch January 25, 2022 08:14
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.

None yet

4 participants