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

NDEV-2252: Clean up tracer implementation #208

Merged
merged 5 commits into from
Oct 10, 2023
Merged

Conversation

andreisilviudragnea
Copy link

@andreisilviudragnea andreisilviudragnea commented Oct 2, 2023

All changes in this PR have been tested by sending debug_traceCall to both Go Ethereum and Tracer API and comparing the returned JSON.

  • Enabled serde_json "preserve_order" feature so StructLog field order is preserved in JSON response bodies for debug calls.
  • Reordered some fields of StructLog and StructLoggerResult to match the order of fields returned by Go Ethereum debug methods.
  • Storage is output only on SLOAD and SSTORE opcodes, in hex format without 0x prefix.
  • Made field tracerConfig optional, as it is in Go Ethereum.
  • Memory is output in hex format without 0x prefix. Empty memory is serialized as an empty JSON array.
  • Apart from used gas, gas and gasCost StructLog fields being always 0 on NeonEVM, debug_traceCall output is identical to Go Ethereum one for Storage contract.
  • Removed unused Event enum variants.

@andreisilviudragnea andreisilviudragnea marked this pull request as draft October 2, 2023 04:11
@andreisilviudragnea andreisilviudragnea marked this pull request as ready for review October 3, 2023 11:02
@andreisilviudragnea andreisilviudragnea force-pushed the NDEV-2252 branch 6 times, most recently from 3fa396c to 5887a8a Compare October 9, 2023 05:59
NDEV-2252: Fix StructLog field order

NDEV-2252: Fix StructLoggerResult field order

NDEV-2252: Output storage only on SLOAD and SSTORE opcodes

NDEV-2252: Output storage in hex format without 0x prefix

NDEV-2252: Output memory in hex format without 0x prefix

NDEV-2252: Add StructLoggerResult serialization tests

NDEV-2252: Fix StructLog format

NDEV-2252: Add github link
Deniskore
Deniskore previously approved these changes Oct 9, 2023
Copy link

@Deniskore Deniskore left a comment

Choose a reason for hiding this comment

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

It looks good to me, but I think @anton-lisanin should thoroughly review the changes since there are changes affecting EVM.

stanislav-tkach
stanislav-tkach previously approved these changes Oct 9, 2023
@andreisilviudragnea
Copy link
Author

@Deniskore Yes, I wiil wait for @anton-lisanin review too.

@neonlabstech
Copy link

Dapps report

Cost report for "Curve" dApp

Action Fee Cost in $ Accounts TRx Estimated Gas Used Gas Used % of EG
Metapool: add liquidity 3.6855504155640317 0.33199217010375864 22 229 14207556 10106080 71.13
Metapool: swap 1 0.8293858182456 0.0747105768760727 19 230 5873516 2300000 39.16
Metapool: swap 2 0.83710017703318 0.07540548168704263 19 233 5906516 2330000 39.45
Metapool: withdraw admin fees 0.00360984817643 0.00032517295782390855 15 1 49500 10000 20.2
Pool: add liquidity 2.629982273157199 0.23690722517663662 26 577 11359524 7287280 64.15
Pool: swap 1 0.973590124644 0.08770041427385673 19 272 6335516 2720000 42.93
Pool: swap 2 0.9747964752984 0.08780908161699469 19 272 6335516 2720000 42.93
Pool: swap 3 0.97459728929312 0.08779113906115067 19 272 6335516 2720000 42.93
Pool: withdraw admin fees 0.00357236030174 0.00032179607256455816 16 1 60500 10000 16.53
Stablecoin: transfer 0.00357196713985 0.00032176065677740415 10 1 33000 10000 30.3
Tri pool: add liquidity 3.554668270039332 0.320202384964181 3 39 15444572 9948040 64.41
Tri pool: swap 1 0.13212843983909 0.011902050583641325 20 37 3750516 370000 9.87
Tri pool: swap 2 0.13212843983909 0.011902050583641325 20 37 3750516 370000 9.87
Tri pool: swap 3 0.12855693341952 0.011580331428270309 20 36 3739516 360000 9.63
Tri pool: apply new fee 0.00357153807902 0.0003217220072352742 8 1 33000 10000 30.3
Tri pool: withdraw admin fees 0.00357197055231 0.00032176096416975346 18 1 60500 10000 16.53
gauge v3: deposit 2.281352136946563 0.20550283168486425 28 1 15191572 6308800 41.53
gauge controller: vote 1.7142785223957597 0.1544211807302966 26 1 20264596 4791520 23.64
gauge controller: vote 1.1714181920976665 0.10552064789324254 26 1 18595588 3274240 17.61
gauge controller: vote 1.1714181920976665 0.10552064789324254 26 1 18595588 3274240 17.61
gauge controller: vote 1.0892460451686106 0.09811863020116135 26 1 20264596 3044560 15.02
gauge controller: vote 1.714252374841127 0.15441882537426382 26 1 20264596 4791520 23.64
gauge controller: vote 1.1714181920976665 0.10552064789324254 26 1 18595588 3274240 17.61
gauge controller: vote 1.7142434744154407 0.15441802362925824 26 1 20264596 4791520 23.64
gauge controller: vote 1.1714121100757198 0.1055201000283548 26 1 18595588 3274240 17.61
gauge controller: vote 1.1714121100757198 0.1055201000283548 26 1 18595588 3274240 17.61

Cost report for "Aave" dApp

Action Fee Cost in $ Accounts TRx Estimated Gas Used Gas Used % of EG
Token mint 0.5597890093741286 0.05042545809101588 9 1 1552280 1527280 98.39
Token approve 0.5597890093741286 0.05042545809101588 9 1 1552280 1527280 98.39
Deposit to lending pool 1.8495674002826774 0.16664922251707173 4 5 9318680 5046200 54.15
Borrow from lending pool 1.2167076135076622 0.10963072165761593 4 30 4876840 3319560 68.07
Repay 0.012828437043695 0.0011558987510442821 4 5 295000 35000 11.86
Flashloan 1.115912751021487 0.10054866004226798 4 4 9418680 3044560 32.32
Withdraw 0.012828437043695 0.0011558987510442821 4 5 3289560 35000 1.06
Liquidation 0.7595461004830936 0.06843845325182986 4 57 3629560 2072280 57.09

Cost report for "Uniswap V3" dApp

Action Fee Cost in $ Accounts TRx Estimated Gas Used Gas Used % of EG
Token approve 0.5586479786342747 0.05033664651253393 9 1 1552280 1527280 98.39
NonfungiblePositionManager - Mint position 6.313444939200706 0.5688692313141654 4 28 38247000 17260240 45.13
NonfungiblePositionManager - Increase liquidity 0.08412932473802 0.0075804231692176965 23 23 9338680 230000 2.46
NonfungiblePositionManager - Decrease Liquidity 0.25569462245593694 0.023039213096564946 17 1 13800520 699040 5.07
NonfungiblePositionManager - Collect Fees 1.1136381605408094 0.09712557353459211 20 1 3119560 3044560 97.6
NonfungiblePositionManager - Burn Liquidity Position 0.08767007197047232 0.007646115519080273 15 1 7641400 239680 3.14
Direct swap 0.00365779672774 0.00031901349795895666 17 1 185000 10000 5.41
Burn transaction 0.08767007197047232 0.007646115519080273 11 1 4606840 239680 5.2
Collect transaction 0.5586479786342747 0.048722293516275536 12 1 1562280 1527280 97.76

Cost report for "Uniswap V2" dApp

Action Fee Cost in $ Accounts TRx Estimated Gas Used Gas Used % of EG
Token approve 0.5586804669649803 0.04872512697499199 9 1 1552280 1527280 98.39
Direct swap 0.00365800944794 0.0003190320502788748 18 1 135000 10000 7.41

Cost report for "Robonomics" dApp

Action Fee Cost in $ Accounts TRx Estimated Gas Used Gas Used % of EG
DutchAuction started 0.0036593769101 0.00031915131302622207 8 1 199021272 10000 0.01
DutchAuction bid 0.5588893167257528 0.04874334173586885 11 1 199026200 1527280 0.77
DutchAuction update stage 0.0036609182094 0.0003192857369206298 8 1 199021272 10000 0.01
DutchAuction claim tokens 0.0036609182094 0.0003192857369206298 12 1 199021272 10000 0.01
XRT transfer 0.5595115643796591 0.04879761085344008 10 1 199023192 1527280 0.77
Factory create lighthouse 7.597905826008552 0.6626487733273551 16 1 199022488 20771680 10.44
XRT increase allowance 0.558651472097892 0.04872259819751714 9 1 199022936 1527280 0.77

Cost report for "Curve-Factory" dApp

Action Fee Cost in $ Accounts TRx Estimated Gas Used Gas Used % of EG
Deploy factory 48.63488399028154 4.241674871351847 3 25 3709916 132952880 3583.72
Deploy 2 180.7395265252014 15.763136354456421 3 70 15002666 494086520 3293.32
Deploy 3 185.87593210487577 16.211106220709826 3 72 15483729 508127880 3281.69
Deploy 4 190.16960979222134 16.585577860361255 3 74 15885269 519865480 3272.63

Cost report for "Yearn" dApp

Action Fee Cost in $ Accounts TRx Estimated Gas Used Gas Used % of EG
Create new release 0.5594536485062706 0.048792559740233894 13 1 1718508 1527280 88.87
Clone strategy 6.954602391378667 0.6065432829992774 13 1 20979068 18996880 90.55
Set strategist authority 0.00366117256573 0.0003193079205214696 8 1 33000 10000 30.3
Migrate strategy 1.782970859579758 0.15550119730815634 18 1 16772580 4882000 29.11
Set emergency shutdown 0.00362701154448 0.0003163285786678981 8 1 33000 10000 30.3
Emergency shutdown 0.00362701154448 0.0003163285786678981 8 1 33000 10000 30.3
Call strategy harvest 1.621630949627281 0.14142999191722044 22 1 10217548 4561840 44.65
Withdraw from vault 0.00357033490809 0.0003113855450952006 14 1 71500 10000 13.99

Cost report for "Compound-Finance" dApp

Action Fee Cost in $ Accounts TRx Estimated Gas Used Gas Used % of EG
borrow erc20 cToken 1.1999688118748544 0.10465487193826939 16 1 5078524 3274240 64.47
borrow ether cToken 0.6438604248881205 0.05615406804407296 11 1 3387516 1756960 51.87
Repay borrow erc20 cToken 0.00366072811328 0.0003192691577521567 17 1 104500 10000 9.57
Mint erc20 cToken 0.5589543298265375 0.048749011831349325 16 1 1751508 1527280 87.2
Mint ether cToken 0.5589091627564754 0.048745072600690664 10 1 1718508 1527280 88.87
Transfer erc20 cToken 1.6699667174195603 0.14564557947106302 21 1 8493540 4561840 53.71
Add reserves for ether cToken 0.00366073057674 0.0003179512533432162 8 1 33000 10000 30.3
Liquidate borrow 0.5590088946108777 0.04855248834778099 20 1 1839508 1527280 83.03
Redeem erc20 cToken 0.00366104649721 0.0003179786924861107 16 1 1740508 10000 0.57

Cost report for "Saddle Finance" dApp

Action Fee Cost in $ Accounts TRx Estimated Gas Used Gas Used % of EG
Add liquidity 0.5609918229858653 0.0487247147787899 3 2 1732280 1532280 88.45
Swap DAI -> USDC 0.00366115737976 0.00031798832314452904 20 1 195000 10000 5.13
Swap USDC -> DAI 0.00366115737976 0.00031798832314452904 20 1 195000 10000 5.13
Remove liquidity 0.00366115737976 0.00031798832314452904 22 1 105000 10000 9.52
Add liquidity in 3 Tokens 0.6392122451306301 0.05551851747380037 4 30 1852280 1787280 96.49
Swap DAI -> USDC 3 pool 0.00357645273897 0.00031063133629761634 20 1 205000 10000 4.88
Swap USDC -> USDT 3 pool 0.00357645273897 0.00031063133629761634 20 1 205000 10000 4.88
Swap USDC -> DAI 3 pool 0.00357645273897 0.00031063133629761634 20 1 205000 10000 4.88
Remove liquidity 3 pool 0.005364679108455 0.00046594700444642454 3 2 125000 15000 12.0
Add liquidity in metapool 0.6503867886213011 0.056489077867119764 3 31 1822280 1822280 100.0
Swap SUSD -> LP metapool 0.00356908262518 0.00030999120808613255 21 1 205000 10000 4.88
Swap USDC -> SUSD metapool 0.18737683782195 0.01627453842452196 4 52 3599560 525000 14.59
Swap DAI -> USDT metapool 0.09636523087986 0.00836976261832558 4 28 6404120 270000 4.22
Remove liquidity in Metapool 0.00356908262518 0.00030999120808613255 22 1 105000 10000 9.52

@andreisilviudragnea andreisilviudragnea merged commit f6bd518 into develop Oct 10, 2023
4 checks passed
@andreisilviudragnea andreisilviudragnea deleted the NDEV-2252 branch October 10, 2023 09:59
afalaleev pushed a commit that referenced this pull request Oct 18, 2023
* NDEV-2252: Use preserve_order serde_json feature

* NDEV-2252: Make StructLog and StructLoggerResult Geth-compatible

NDEV-2252: Fix StructLog field order

NDEV-2252: Fix StructLoggerResult field order

NDEV-2252: Output storage only on SLOAD and SSTORE opcodes

NDEV-2252: Output storage in hex format without 0x prefix

NDEV-2252: Output memory in hex format without 0x prefix

NDEV-2252: Add StructLoggerResult serialization tests

NDEV-2252: Fix StructLog format

NDEV-2252: Add github link

* NDEV-2252: Make tracer_config optional

* NDEV-2252: Remove unused trace Events

* NDEV-2252: Add more links to Geth structs
afalaleev pushed a commit that referenced this pull request Oct 18, 2023
* NDEV-2252: Use preserve_order serde_json feature

* NDEV-2252: Make StructLog and StructLoggerResult Geth-compatible

NDEV-2252: Fix StructLog field order

NDEV-2252: Fix StructLoggerResult field order

NDEV-2252: Output storage only on SLOAD and SSTORE opcodes

NDEV-2252: Output storage in hex format without 0x prefix

NDEV-2252: Output memory in hex format without 0x prefix

NDEV-2252: Add StructLoggerResult serialization tests

NDEV-2252: Fix StructLog format

NDEV-2252: Add github link

* NDEV-2252: Make tracer_config optional

* NDEV-2252: Remove unused trace Events

* NDEV-2252: Add more links to Geth structs
afalaleev pushed a commit that referenced this pull request Oct 27, 2023
* NDEV-2252: Use preserve_order serde_json feature

* NDEV-2252: Make StructLog and StructLoggerResult Geth-compatible

NDEV-2252: Fix StructLog field order

NDEV-2252: Fix StructLoggerResult field order

NDEV-2252: Output storage only on SLOAD and SSTORE opcodes

NDEV-2252: Output storage in hex format without 0x prefix

NDEV-2252: Output memory in hex format without 0x prefix

NDEV-2252: Add StructLoggerResult serialization tests

NDEV-2252: Fix StructLog format

NDEV-2252: Add github link

* NDEV-2252: Make tracer_config optional

* NDEV-2252: Remove unused trace Events

* NDEV-2252: Add more links to Geth structs
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.

5 participants