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

ExecutionEffort and Computation is not the same in the stable cadence emulator #542

Closed
bjartek opened this issue Dec 21, 2023 · 3 comments · Fixed by #543
Closed

ExecutionEffort and Computation is not the same in the stable cadence emulator #542

bjartek opened this issue Dec 21, 2023 · 3 comments · Fixed by #543
Assignees
Labels

Comments

@bjartek
Copy link
Contributor

bjartek commented Dec 21, 2023

Instructions

Please fill out the template below to the best of your ability and include a label indicating which tool/service you were working with when you encountered the problem.

Problem

Feed decuted event looks like this

Fields: map[string]interface {}{
        "amount": 1e-05,
        "executionEffort": 2.9e-07,
        "inclusionEffort": 1.0,
      },
      

so 29 effort

Meters reported looks like this


map[string]interface {}{
  "computationIntensities": map[string]interface {}{
    "1001": 5.0,
    "1003": 5.0,
    "1025": 2.0,
    "1026": 96.0,
    "1080": 250.0,
    "2005": 1.0,
    "2011": 1.0,
    "2014": 1.0,
    "2015": 1.0,
    "2016": 1.0,
    "2020": 2286.0,
    "2022": 1.0,
    "2026": 270.0,
    "2034": 3.0,
    "2036": 1.0,
  },
  "computationUsed": 31.0,
  "ledgerInteractionUsed": 97269.0,
  "memoryEstimate": 149745.0,
  "memoryIntensities": map[string]interface {}{
    "1": 7.0,
    "100": 6.0,
    "102": 5.0,
    "103": 694.0,
    "105": 376.0,
    "106": 2.0,
    "107": 244.0,
    "108": 30.0,
    "109": 13.0,
    "11": 1.0,
    "110": 8.0,
    "111": 11.0,
    "112": 8.0,
    "115": 20.0,
    "116": 24.0,
    "117": 27.0,
    "119": 8.0,
    "12": 2.0,
    "120": 4.0,
    "127": 9.0,
    "128": 1.0,
    "129": 1.0,
    "13": 1.0,
    "130": 8.0,
    "131": 4.0,
    "133": 12.0,
    "137": 5.0,
    "138": 1.0,
    "139": 4.0,
    "14": 3.0,
    "140": 4.0,
    "147": 4.0,
    "148": 7.0,
    "149": 1.0,
    "15": 8.0,
    "151": 2.0,
    "153": 108.0,
    "154": 23.0,
    "155": 38.0,
    "156": 2.0,
    "158": 1.0,
    "159": 19.0,
    "16": 5.0,
    "162": 1.0,
    "165": 3.0,
    "166": 1.0,
    "17": 1.0,
    "172": 29.0,
    "173": 1.0,
    "174": 2.0,
    "176": 8.0,
    "177": 2236.0,
    "178": 1176.0,
    "179": 2.0,
    "18": 8.0,
    "180": 12.0,
    "181": 8.0,
    "182": 9.0,
    "187": 5.0,
    "19": 5.0,
    "23": 5.0,
    "24": 0.0,
    "25": 161.0,
    "30": 2.0,
    "31": 2.0,
    "32": 8.0,
    "34": 2.0,
    "39": 3.0,
    "4": 88.0,
    "41": 8.0,
    "5": 6.0,
    "7": 5.0,
    "8": 4.0,
    "9": 1.0,
    "94": 1034.0,
    "95": 5.0,
    "96": 284.0,
    "97": 11.0,
    "98": 2.0,
  },
}

so this reports 31

These should be the same should the not?

Steps to Reproduce

Run a transaction against the emulator with the relevant version
github.com/onflow/flow-emulator v0.59.1-0.20231218185945-9116c416533f

Acceptance Criteria

Effort and computation are the same.

Context

I am trying to update overflow to this code and I see that the emulator is reporting different numbers for FeesDeducted and computationUsed, is that exepected? because it has not been like that before this versio

@bjartek
Copy link
Contributor Author

bjartek commented Dec 21, 2023

I see the same in 0.59.0 of emulator

@janezpodhostnik
Copy link
Contributor

janezpodhostnik commented Jan 5, 2024

I'm trying t understand this better and I'm replicating the scenario, but I'm missing something.

  • I got the emulator at commit 9116c41
  • run it with go run ./cmd/emulator --transaction-fees=true --verbose
  • send a tx with flow transactions send <(echo """transaction{prepare(s : &Account){ var i = 0;while i < 10000 {i=i+1}}}""") --signer emulator-account
  • the resulting event has executionEffort (UFix64): 0.00000478
  • which matches the emulator output:
    DBG ⭐ Transaction executed computationUsed=478 memoryEstimate=25369033 txID=b5b11e587630d03db246596381739b35cafff3a147e84fb6497e397b6f96cd0a

But I'm not sure at which point you are capturing the meter output. If you are capturing the meter output to late the system transaction might be included in it.

p.s.: I tried the fix from @bluesign #543 but that doesn't change anything in my scenario

@janezpodhostnik
Copy link
Contributor

never mind, figured out whats going on after I manually enabled logging the computation intesities. Yeah #543 will fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants