celo-blockchain icon indicating copy to clipboard operation
celo-blockchain copied to clipboard

WIP: Feature/go native trace

Open jsvisa opened this issue 2 years ago • 1 comments

implements https://github.com/celo-org/celo-blockchain/issues/1970

DON'T MERGE, test in process.

jsvisa avatar Oct 31 '22 13:10 jsvisa

@palango Seems we don't have a way to decode all bytes into ethcompatible transactions, those test cases https://github.com/celo-org/celo-blockchain/blob/master/eth/tracers/tracers_test.go#L205-L297 can't pass :sob:

jsvisa avatar Nov 01 '22 01:11 jsvisa

@palango Is there any special logical for the 0x000000000000000000000000000000000000ce10's behavior,

eg this tx 0xde643a057c0ec309da8ee3ebf39bf0101c65d18ef16e4ac3c1b6fe8b951ba4f0, the traces of this tx is as below:

{
  "type": "CALL",
  "from": "0x3de7830558d0d64459c60a53d9d65c3c8ea724ee",
  "to": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
  "value": "0x0",
  "gas": "0x176bba",
  "gasUsed": "0x49685",
  "input": "0x8e78cd920000000000000000000000000000000000000000000000043a77aabd00780000000000000000000000000000471ece3750da237f93b8e339c536989b8978a438000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a00000000000000000000000062d5b84be28a183abb507e125b384122d2c25fae00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000082fdff53547141d1a4439b0bfef34ffd366e77dc00000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000003000000000000000000000000e3d8bd6aed4f159bc8000a9cd47cffdb95f9612100000000000000000000000082825d0554fa07f7fc52ab63c961f330fdefa8e80000000000000000000000005615cdab10dc425a742d643d949a7f474c01abc40000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000471ece3750da237f93b8e339c536989b8978a438000000000000000000000000918146359264c492bd6934071c6bd31c854edbc300000000000000000000000002de4766c272abc10bc88c220d214a26960a7e92000000000000000000000000000000000000000000000000000000000000000200000000000000000000000002de4766c272abc10bc88c220d214a26960a7e92000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a",
  "output": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a556e697377617056323a205452414e534645525f4641494c4544000000000000",
  "error": "execution reverted",
  "calls": [
    {
      "type": "STATICCALL",
      "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
      "to": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
      "gas": "0x16d2fc",
      "gasUsed": "0x1663",
      "input": "0xd06ca61f0000000000000000000000000000000000000000000000043a77aabd0078000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a000000000000000000000000471ece3750da237f93b8e339c536989b8978a438",
      "output": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000043a77aabd0078000000000000000000000000000000000000000000000000000610a36413044e3a7b",
      "calls": [
        {
          "type": "STATICCALL",
          "from": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
          "to": "0x1e593f1fe7b61c53874b54ec0c59fd0d5eb8621e",
          "gas": "0x166bb0",
          "gasUsed": "0x4b4",
          "input": "0x0902f1ac",
          "output": "0x0000000000000000000000000000000000000000000005827556774f283cda9b0000000000000000000000000000000000000000000003d02d440d172678602f000000000000000000000000000000000000000000000000000000006352c4ea"
        }
      ]
    },
    {
      "type": "STATICCALL",
      "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
      "to": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
      "gas": "0x16a4e9",
      "gasUsed": "0x2806",
      "input": "0xd06ca61f00000000000000000000000000000000000000000000000610a36413044e3a7b00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000471ece3750da237f93b8e339c536989b8978a438000000000000000000000000918146359264c492bd6934071c6bd31c854edbc300000000000000000000000002de4766c272abc10bc88c220d214a26960a7e92",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000610a36413044e3a7b00000000000000000000000000000000000000000000000496190e563af3fefb0000000000000000000000000000000000000000000000021ab7ed5a3cda16cd",
      "calls": [
        {
          "type": "STATICCALL",
          "from": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
          "to": "0xb460f9ae1fea4f77107146c1960bb1c978118816",
          "gas": "0x163e5d",
          "gasUsed": "0x4b4",
          "input": "0x0902f1ac",
          "output": "0x00000000000000000000000000000000000000000000532d4adff2d49e7c2237000000000000000000000000000000000000000000003f1aed44df009ef35cce000000000000000000000000000000000000000000000000000000006351c860"
        },
        {
          "type": "STATICCALL",
          "from": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
          "to": "0xec5c9c99ad30adf396ac4b48fba09dc34819c65a",
          "gas": "0x162d3e",
          "gasUsed": "0x4b4",
          "input": "0x0902f1ac",
          "output": "0x000000000000000000000000000000000000000000000976b6a27ea941df0bb500000000000000000000000000000000000000000000148bb728a962b08950d6000000000000000000000000000000000000000000000000000000006351c860"
        }
      ]
    },
    {
      "type": "CALL",
      "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
      "to": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
      "value": "0x0",
      "gas": "0x166e13",
      "gasUsed": "0x1966f",
      "input": "0xc6a5026a00000000000000000000000002de4766c272abc10bc88c220d214a26960a7e92000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a0000000000000000000000000000000000000000000000021ab7ed5a3cda16cd0000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000000000000000000000000000000000000000000000",
      "output": "0x00000000000000000000000000000000000000000000000458ad6069c25e791a0000000000000000000000000000000000000001706a01091ec009f85d2aa7750000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001678d",
      "calls": [
        {
          "type": "CALL",
          "from": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
          "to": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
          "value": "0x0",
          "gas": "0x16061a",
          "gasUsed": "0x15f2a",
          "input": "0x128acb0800000000000000000000000082825d0554fa07f7fc52ab63c961f330fdefa8e800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000021ab7ed5a3cda16cd00000000000000000000000000000000000000000000000000000001000276a400000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002b02de4766c272abc10bc88c220d214a26960a7e92000bb8765de816845861e75a25fca122bb6898b8b1282a000000000000000000000000000000000000000000",
          "error": "execution reverted",
          "calls": [
            {
              "type": "CALL",
              "from": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
              "to": "0x765de816845861e75a25fca122bb6898b8b1282a",
              "value": "0x0",
              "gas": "0x153036",
              "gasUsed": "0xb555",
              "input": "0xa9059cbb00000000000000000000000082825d0554fa07f7fc52ab63c961f330fdefa8e800000000000000000000000000000000000000000000000458ad6069c25e791a",
              "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
              "calls": [
                {
                  "type": "DELEGATECALL",
                  "from": "0x765de816845861e75a25fca122bb6898b8b1282a",
                  "to": "0x18e6bfdc909063f7445e410a5495264619495bcb",
                  "gas": "0x14d27c",
                  "gasUsed": "0xabef",
                  "input": "0xa9059cbb00000000000000000000000082825d0554fa07f7fc52ab63c961f330fdefa8e800000000000000000000000000000000000000000000000458ad6069c25e791a",
                  "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
                  "calls": [
                    {
                      "type": "STATICCALL",
                      "from": "0x765de816845861e75a25fca122bb6898b8b1282a",
                      "to": "0x000000000000000000000000000000000000ce10",
                      "gas": "0x1469fe",
                      "gasUsed": "0xf52",
                      "input": "0xdcf0aaed24e33447c847c15e68fca3f15a635d2d4d83cb99d7befc9068c4a148521fccf4",
                      "output": "0x00000000000000000000000047a472f45057a9d79d62c6427367016409f4ff5a",
                      "calls": [
                        {
                          "type": "DELEGATECALL",
                          "from": "0x000000000000000000000000000000000000ce10",
                          "to": "0x203fdf86a00999107df531fa00b4ba81d674cb66",
                          "gas": "0x140f63",
                          "gasUsed": "0x5f2",
                          "input": "0xdcf0aaed24e33447c847c15e68fca3f15a635d2d4d83cb99d7befc9068c4a148521fccf4",
                          "output": "0x00000000000000000000000047a472f45057a9d79d62c6427367016409f4ff5a"
                        }
                      ]
                    },
                    {
                      "type": "STATICCALL",
                      "from": "0x765de816845861e75a25fca122bb6898b8b1282a",
                      "to": "0x47a472f45057a9d79d62c6427367016409f4ff5a",
                      "gas": "0x14560f",
                      "gasUsed": "0xe58",
                      "input": "0xe5839836000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a",
                      "output": "0x0000000000000000000000000000000000000000000000000000000000000000",
                      "calls": [
                        {
                          "type": "DELEGATECALL",
                          "from": "0x47a472f45057a9d79d62c6427367016409f4ff5a",
                          "to": "0xa79cdb272799175a118a4ce49cecbf3ec86649e6",
                          "gas": "0x13fbc4",
                          "gasUsed": "0x4f8",
                          "input": "0xe5839836000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a",
                          "output": "0x0000000000000000000000000000000000000000000000000000000000000000"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "STATICCALL",
              "from": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
              "to": "0x02de4766c272abc10bc88c220d214a26960a7e92",
              "gas": "0x14773c",
              "gasUsed": "0xcd5",
              "input": "0x70a082310000000000000000000000007da99753ff017f1b7afb2c8c0542718dc9f15f21",
              "output": "0x000000000000000000000000000000000000000000000f7ecd5d6fc33e275e89",
              "calls": [
                {
                  "type": "DELEGATECALL",
                  "from": "0x02de4766c272abc10bc88c220d214a26960a7e92",
                  "to": "0xf5c3d35c14dbc1fb7c977061a2bc679e32be168d",
                  "gas": "0x141e3c",
                  "gasUsed": "0x56b",
                  "input": "0x70a082310000000000000000000000007da99753ff017f1b7afb2c8c0542718dc9f15f21",
                  "output": "0x000000000000000000000000000000000000000000000f7ecd5d6fc33e275e89"
                }
              ]
            },
            {
              "type": "CALL",
              "from": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
              "to": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
              "value": "0x0",
              "gas": "0x1467a0",
              "gasUsed": "0x136b",
              "input": "0xfa461e330000000000000000000000000000000000000000000000021ab7ed5a3cda16cdfffffffffffffffffffffffffffffffffffffffffffffffba7529f963da186e60000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002b02de4766c272abc10bc88c220d214a26960a7e92000bb8765de816845861e75a25fca122bb6898b8b1282a000000000000000000000000000000000000000000",
              "error": "execution reverted",
              "calls": [
                {
                  "type": "STATICCALL",
                  "from": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
                  "to": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
                  "gas": "0x14089c",
                  "gasUsed": "0x2b8",
                  "input": "0x3850c7bd",
                  "output": "0x0000000000000000000000000000000000000001706a01091ec009f85d2aa7750000000000000000000000000000000000000000000000000000000000001c7000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
                }
              ]
            }
          ]
        },
        {
          "type": "STATICCALL",
          "from": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
          "to": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
          "gas": "0x14aa73",
          "gasUsed": "0x574",
          "input": "0x3850c7bd",
          "output": "0x00000000000000000000000000000000000000017083ffc030096d2fb3f0cca00000000000000000000000000000000000000000000000000000000000001c76000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"
        },
        {
          "type": "STATICCALL",
          "from": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
          "to": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
          "gas": "0x149f6c",
          "gasUsed": "0x117",
          "input": "0xd0c93a7c",
          "output": "0x000000000000000000000000000000000000000000000000000000000000003c"
        },
        {
          "type": "STATICCALL",
          "from": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
          "to": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
          "gas": "0x149ca4",
          "gasUsed": "0x117",
          "input": "0xd0c93a7c",
          "output": "0x000000000000000000000000000000000000000000000000000000000000003c"
        },
        {
          "type": "STATICCALL",
          "from": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
          "to": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
          "gas": "0x1499cc",
          "gasUsed": "0x117",
          "input": "0xd0c93a7c",
          "output": "0x000000000000000000000000000000000000000000000000000000000000003c"
        },
        {
          "type": "STATICCALL",
          "from": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
          "to": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
          "gas": "0x149705",
          "gasUsed": "0x117",
          "input": "0xd0c93a7c",
          "output": "0x000000000000000000000000000000000000000000000000000000000000003c"
        },
        {
          "type": "STATICCALL",
          "from": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
          "to": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
          "gas": "0x1493f8",
          "gasUsed": "0x4c9",
          "input": "0x5339c2960000000000000000000000000000000000000000000000000000000000000000",
          "output": "0x0000000000000000000080000040200000100000000000000000000000000000"
        },
        {
          "type": "STATICCALL",
          "from": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
          "to": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
          "gas": "0x148d6d",
          "gasUsed": "0x20d",
          "input": "0x5339c2960000000000000000000000000000000000000000000000000000000000000000",
          "output": "0x0000000000000000000080000040200000100000000000000000000000000000"
        },
        {
          "type": "STATICCALL",
          "from": "0x82825d0554fa07f7fc52ab63c961f330fdefa8e8",
          "to": "0x7da99753ff017f1b7afb2c8c0542718dc9f15f21",
          "gas": "0x148875",
          "gasUsed": "0x20d",
          "input": "0x5339c2960000000000000000000000000000000000000000000000000000000000000000",
          "output": "0x0000000000000000000080000040200000100000000000000000000000000000"
        }
      ]
    },
    {
      "type": "STATICCALL",
      "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
      "to": "0x62d5b84be28a183abb507e125b384122d2c25fae",
      "gas": "0x149949",
      "gasUsed": "0x514",
      "input": "0xe6a43905000000000000000000000000471ece3750da237f93b8e339c536989b8978a438000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a",
      "output": "0x0000000000000000000000001e593f1fe7b61c53874b54ec0c59fd0d5eb8621e"
    },
    {
      "type": "STATICCALL",
      "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
      "to": "0x1e593f1fe7b61c53874b54ec0c59fd0d5eb8621e",
      "gas": "0x1491a7",
      "gasUsed": "0x451",
      "input": "0x0dfe1681",
      "output": "0x000000000000000000000000471ece3750da237f93b8e339c536989b8978a438"
    },
    {
      "type": "CALL",
      "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
      "to": "0x1e593f1fe7b61c53874b54ec0c59fd0d5eb8621e",
      "value": "0x0",
      "gas": "0x1484ce",
      "gasUsed": "0x202c7",
      "input": "0x022c0d9f00000000000000000000000000000000000000000000000610a36413044e3a7b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d7200000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000471ece3750da237f93b8e339c536989b8978a438000000000000000000000000918146359264c492bd6934071c6bd31c854edbc300000000000000000000000002de4766c272abc10bc88c220d214a26960a7e92000000000000000000000000000000000000000000000000000000000000000200000000000000000000000002de4766c272abc10bc88c220d214a26960a7e92000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a",
      "error": "execution reverted",
      "calls": [
        {
          "type": "CALL",
          "from": "0x1e593f1fe7b61c53874b54ec0c59fd0d5eb8621e",
          "to": "0x471ece3750da237f93b8e339c536989b8978a438",
          "value": "0x0",
          "gas": "0x141246",
          "gasUsed": "0x3a46",
          "input": "0xa9059cbb000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d7200000000000000000000000000000000000000000000000610a36413044e3a7b",
          "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
          "calls": [
            {
              "type": "DELEGATECALL",
              "from": "0x471ece3750da237f93b8e339c536989b8978a438",
              "to": "0x4ddeb8f7041ab3260c6ec5afb6feab0650f4abb4",
              "gas": "0x13b904",
              "gasUsed": "0x30e0",
              "input": "0xa9059cbb000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d7200000000000000000000000000000000000000000000000610a36413044e3a7b",
              "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
              "calls": [
                {
                  "type": "CALL",
                  "from": "0x471ece3750da237f93b8e339c536989b8978a438",
                  "to": "0x00000000000000000000000000000000000000fd",
                  "value": "0x0",
                  "gas": "0x1364b2",
                  "gasUsed": "0x2328",
                  "input": "0x0000000000000000000000001e593f1fe7b61c53874b54ec0c59fd0d5eb8621e000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d7200000000000000000000000000000000000000000000000610a36413044e3a7b",
                  "output": "0x0000000000000000000000001e593f1fe7b61c53874b54ec0c59fd0d5eb8621e000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d7200000000000000000000000000000000000000000000000610a36413044e3a7b",
                  "calls": [
                    {
                      "type": "STATICCALL",
                      "from": "0x0000000000000000000000000000000000000000",
                      "to": "0x000000000000000000000000000000000000ce10",
                      "gas": "0x186a0",
                      "gasUsed": "0xffec9b4e",
                      "input": "0xdd927233d7e89ade8430819f08bf97a087285824af3351ee12d72a2d132b0c6c0687bfaf",
                      "output": "0x000000000000000000000000471ece3750da237f93b8e339c536989b8978a438",
                      "calls": [
                        {
                          "type": "DELEGATECALL",
                          "from": "0x000000000000000000000000000000000000ce10",
                          "to": "0x203fdf86a00999107df531fa00b4ba81d674cb66",
                          "gas": "0x1364b2",
                          "gasUsed": "0x0",
                          "input": "0xdd927233d7e89ade8430819f08bf97a087285824af3351ee12d72a2d132b0c6c0687bfaf",
                          "output": "0x000000000000000000000000471ece3750da237f93b8e339c536989b8978a438"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "type": "CALL",
          "from": "0x1e593f1fe7b61c53874b54ec0c59fd0d5eb8621e",
          "to": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
          "value": "0x0",
          "gas": "0x13d572",
          "gasUsed": "0x1a3d1",
          "input": "0x10d1e85c000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d7200000000000000000000000000000000000000000000000610a36413044e3a7b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000471ece3750da237f93b8e339c536989b8978a438000000000000000000000000918146359264c492bd6934071c6bd31c854edbc300000000000000000000000002de4766c272abc10bc88c220d214a26960a7e92000000000000000000000000000000000000000000000000000000000000000200000000000000000000000002de4766c272abc10bc88c220d214a26960a7e92000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a",
          "error": "execution reverted",
          "calls": [
            {
              "type": "STATICCALL",
              "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
              "to": "0x1e593f1fe7b61c53874b54ec0c59fd0d5eb8621e",
              "gas": "0x13604f",
              "gasUsed": "0x195",
              "input": "0x0dfe1681",
              "output": "0x000000000000000000000000471ece3750da237f93b8e339c536989b8978a438"
            },
            {
              "type": "STATICCALL",
              "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
              "to": "0x1e593f1fe7b61c53874b54ec0c59fd0d5eb8621e",
              "gas": "0x135c22",
              "gasUsed": "0x17d",
              "input": "0xd21220a7",
              "output": "0x000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a"
            },
            {
              "type": "STATICCALL",
              "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
              "to": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
              "gas": "0x135279",
              "gasUsed": "0x10b0",
              "input": "0x1f00ca7400000000000000000000000000000000000000000000000610a36413044e3a7b00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a000000000000000000000000471ece3750da237f93b8e339c536989b8978a438",
              "output": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000043a77aabd0078000000000000000000000000000000000000000000000000000610a36413044e3a7b",
              "calls": [
                {
                  "type": "STATICCALL",
                  "from": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
                  "to": "0x1e593f1fe7b61c53874b54ec0c59fd0d5eb8621e",
                  "gas": "0x12fc4f",
                  "gasUsed": "0x1f8",
                  "input": "0x0902f1ac",
                  "output": "0x0000000000000000000000000000000000000000000005827556774f283cda9b0000000000000000000000000000000000000000000003d02d440d172678602f000000000000000000000000000000000000000000000000000000006352c4ea"
                }
              ]
            },
            {
              "type": "CALL",
              "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
              "to": "0x471ece3750da237f93b8e339c536989b8978a438",
              "value": "0x0",
              "gas": "0x133939",
              "gasUsed": "0x5e5e",
              "input": "0x095ea7b3000000000000000000000000e3d8bd6aed4f159bc8000a9cd47cffdb95f9612100000000000000000000000000000000000000000000000610a36413044e3a7b",
              "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
              "calls": [
                {
                  "type": "DELEGATECALL",
                  "from": "0x471ece3750da237f93b8e339c536989b8978a438",
                  "to": "0x4ddeb8f7041ab3260c6ec5afb6feab0650f4abb4",
                  "gas": "0x12e920",
                  "gasUsed": "0x5ad4",
                  "input": "0x095ea7b3000000000000000000000000e3d8bd6aed4f159bc8000a9cd47cffdb95f9612100000000000000000000000000000000000000000000000610a36413044e3a7b",
                  "output": "0x0000000000000000000000000000000000000000000000000000000000000001"
                }
              ]
            },
            {
              "type": "CALL",
              "from": "0xd5d444af2788e78fb956818b577be9ebc5485d72",
              "to": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
              "value": "0x0",
              "gas": "0x12d267",
              "gasUsed": "0xed0f",
              "input": "0x38ed173900000000000000000000000000000000000000000000000610a36413044e3a7b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d720000000000000000000000000000000000000000000000008ac7230489e7ffff0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000471ece3750da237f93b8e339c536989b8978a438000000000000000000000000918146359264c492bd6934071c6bd31c854edbc300000000000000000000000002de4766c272abc10bc88c220d214a26960a7e92",
              "error": "execution reverted",
              "calls": [
                {
                  "type": "STATICCALL",
                  "from": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
                  "to": "0xb460f9ae1fea4f77107146c1960bb1c978118816",
                  "gas": "0x127e1b",
                  "gasUsed": "0x1f8",
                  "input": "0x0902f1ac",
                  "output": "0x00000000000000000000000000000000000000000000532d4adff2d49e7c2237000000000000000000000000000000000000000000003f1aed44df009ef35cce000000000000000000000000000000000000000000000000000000006351c860"
                },
                {
                  "type": "STATICCALL",
                  "from": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
                  "to": "0xec5c9c99ad30adf396ac4b48fba09dc34819c65a",
                  "gas": "0x1272c0",
                  "gasUsed": "0x1f8",
                  "input": "0x0902f1ac",
                  "output": "0x000000000000000000000000000000000000000000000976b6a27ea941df0bb500000000000000000000000000000000000000000000148bb728a962b08950d6000000000000000000000000000000000000000000000000000000006351c860"
                },
                {
                  "type": "CALL",
                  "from": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
                  "to": "0x471ece3750da237f93b8e339c536989b8978a438",
                  "value": "0x0",
                  "gas": "0x12659c",
                  "gasUsed": "0x389c",
                  "input": "0x23b872dd000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d72000000000000000000000000b460f9ae1fea4f77107146c1960bb1c97811881600000000000000000000000000000000000000000000000610a36413044e3a7b",
                  "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
                  "calls": [
                    {
                      "type": "DELEGATECALL",
                      "from": "0x471ece3750da237f93b8e339c536989b8978a438",
                      "to": "0x4ddeb8f7041ab3260c6ec5afb6feab0650f4abb4",
                      "gas": "0x1218cb",
                      "gasUsed": "0x350c",
                      "input": "0x23b872dd000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d72000000000000000000000000b460f9ae1fea4f77107146c1960bb1c97811881600000000000000000000000000000000000000000000000610a36413044e3a7b",
                      "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
                      "calls": [
                        {
                          "type": "CALL",
                          "from": "0x471ece3750da237f93b8e339c536989b8978a438",
                          "to": "0x00000000000000000000000000000000000000fd",
                          "value": "0x0",
                          "gas": "0x11c9d8",
                          "gasUsed": "0x2328",
                          "input": "0x000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d72000000000000000000000000b460f9ae1fea4f77107146c1960bb1c97811881600000000000000000000000000000000000000000000000610a36413044e3a7b",
                          "output": "0x000000000000000000000000d5d444af2788e78fb956818b577be9ebc5485d72000000000000000000000000b460f9ae1fea4f77107146c1960bb1c97811881600000000000000000000000000000000000000000000000610a36413044e3a7b",
                          "calls": [
                            {
                              "type": "STATICCALL",
                              "from": "0x0000000000000000000000000000000000000000",
                              "to": "0x000000000000000000000000000000000000ce10",
                              "gas": "0x186a0",
                              "gasUsed": "0xffee3628",
                              "input": "0xdd927233d7e89ade8430819f08bf97a087285824af3351ee12d72a2d132b0c6c0687bfaf",
                              "output": "0x000000000000000000000000471ece3750da237f93b8e339c536989b8978a438",
                              "calls": [
                                {
                                  "type": "DELEGATECALL",
                                  "from": "0x000000000000000000000000000000000000ce10",
                                  "to": "0x203fdf86a00999107df531fa00b4ba81d674cb66",
                                  "gas": "0x11c9d8",
                                  "gasUsed": "0x0",
                                  "input": "0xdd927233d7e89ade8430819f08bf97a087285824af3351ee12d72a2d132b0c6c0687bfaf",
                                  "output": "0x000000000000000000000000471ece3750da237f93b8e339c536989b8978a438"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "CALL",
                  "from": "0xe3d8bd6aed4f159bc8000a9cd47cffdb95f96121",
                  "to": "0xb460f9ae1fea4f77107146c1960bb1c978118816",
                  "value": "0x0",
                  "gas": "0x1221c9",
                  "gasUsed": "0x85ec",
                  "input": "0x022c0d9f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000496190e563af3fefb000000000000000000000000ec5c9c99ad30adf396ac4b48fba09dc34819c65a00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000",
                  "error": "execution reverted",
                  "calls": [
                    {
                      "type": "CALL",
                      "from": "0xb460f9ae1fea4f77107146c1960bb1c978118816",
                      "to": "0x918146359264c492bd6934071c6bd31c854edbc3",
                      "value": "0x0",
                      "gas": "0x11b5fe",
                      "gasUsed": "0x60fe",
                      "input": "0xa9059cbb000000000000000000000000ec5c9c99ad30adf396ac4b48fba09dc34819c65a00000000000000000000000000000000000000000000000496190e563af3fefb",
                      "error": "execution reverted",
                      "calls": [
                        {
                          "type": "DELEGATECALL",
                          "from": "0x918146359264c492bd6934071c6bd31c854edbc3",
                          "to": "0x55bfced2451b2154e06604d4269c9349f31141e6",
                          "gas": "0x11672e",
                          "gasUsed": "0x58af",
                          "input": "0xa9059cbb000000000000000000000000ec5c9c99ad30adf396ac4b48fba09dc34819c65a00000000000000000000000000000000000000000000000496190e563af3fefb",
                          "error": "execution reverted",
                          "calls": [
                            {
                              "type": "STATICCALL",
                              "from": "0x918146359264c492bd6934071c6bd31c854edbc3",
                              "to": "0x970b12522ca9b4054807a2c5b736149a5be6f670",
                              "gas": "0x111545",
                              "gasUsed": "0xdb0",
                              "input": "0xd15e0053000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a",
                              "output": "0x00000000000000000000000000000000000000000355a4ce7d80af2ace43f2ab",
                              "calls": [
                                {
                                  "type": "DELEGATECALL",
                                  "from": "0x970b12522ca9b4054807a2c5b736149a5be6f670",
                                  "to": "0xe50b13fecdbee8937580b5628050340c6212ed5a",
                                  "gas": "0x10c8fb",
                                  "gasUsed": "0x571",
                                  "input": "0xd15e0053000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a",
                                  "output": "0x00000000000000000000000000000000000000000355a4ce7d80af2ace43f2ab"
                                }
                              ]
                            },
                            {
                              "type": "CALL",
                              "from": "0x918146359264c492bd6934071c6bd31c854edbc3",
                              "to": "0x970b12522ca9b4054807a2c5b736149a5be6f670",
                              "value": "0x0",
                              "gas": "0x10d436",
                              "gasUsed": "0x9e7",
                              "input": "0xd5ed3933000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a000000000000000000000000b460f9ae1fea4f77107146c1960bb1c978118816000000000000000000000000ec5c9c99ad30adf396ac4b48fba09dc34819c65a00000000000000000000000000000000000000000000000496190e563af3fefb000000000000000000000000000000000000000000003ed62cab1c7c2185253300000000000000000000000000000000000000000000147554c2eb1438974940",
                              "error": "execution reverted",
                              "calls": [
                                {
                                  "type": "DELEGATECALL",
                                  "from": "0x970b12522ca9b4054807a2c5b736149a5be6f670",
                                  "to": "0xe50b13fecdbee8937580b5628050340c6212ed5a",
                                  "gas": "0x108e9a",
                                  "gasUsed": "0x75f",
                                  "input": "0xd5ed3933000000000000000000000000765de816845861e75a25fca122bb6898b8b1282a000000000000000000000000b460f9ae1fea4f77107146c1960bb1c978118816000000000000000000000000ec5c9c99ad30adf396ac4b48fba09dc34819c65a00000000000000000000000000000000000000000000000496190e563af3fefb000000000000000000000000000000000000000000003ed62cab1c7c2185253300000000000000000000000000000000000000000000147554c2eb1438974940",
                                  "error": "execution reverted"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

the lines around 472 as below:

[
    {
      "type": "STATICCALL",
      "from": "0x0000000000000000000000000000000000000000",
      "to": "0x000000000000000000000000000000000000ce10",
      "gas": "0x186a0",
      "gasUsed": "0xffee3628",
      "input": "0xdd927233d7e89ade8430819f08bf97a087285824af3351ee12d72a2d132b0c6c0687bfaf",
      "output": "0x000000000000000000000000471ece3750da237f93b8e339c536989b8978a438",
      "calls": [
        {
          "type": "DELEGATECALL",
          "from": "0x000000000000000000000000000000000000ce10",
          "to": "0x203fdf86a00999107df531fa00b4ba81d674cb66",
          "gas": "0x11c9d8",
          "gasUsed": "0x0",
          "input": "0xdd927233d7e89ade8430819f08bf97a087285824af3351ee12d72a2d132b0c6c0687bfaf",
          "output": "0x000000000000000000000000471ece3750da237f93b8e339c536989b8978a438"
        }
      ]
    }
  ]

the gasUsed is larger than gas???

jsvisa avatar Nov 07 '22 14:11 jsvisa

@jsvisa Thanks a lot for looking into this. I don't have much experience with this code, but someone from team is going to have a look. It might take a few days though.

palango avatar Nov 07 '22 17:11 palango

@jsvisa @palango if I'm not mistaken that's the address for the directory of core contracts. Without taking a real look at this I'd say it could have something to do with either paying vaildator rewards at the end of the tx or paying the gas with a different currency than the native one (celo stable tokens)

hbandura avatar Nov 07 '22 21:11 hbandura

@hbandura thanks for your explanation.

eg:

  "gas": "0x186a0",
   "gasUsed": "0xffee3628",

Does this means gas in the CELO native token, but gasUsed is in celo stable token? If that's the case, how do we distinguish between native and stable, and how to exchange the stable back to native?

Thank you in advance.

jsvisa avatar Nov 08 '22 02:11 jsvisa

Does this means gas in the CELO native token, but gasUsed is in celo stable token? If that's the case, how do we distinguish between native and stable, and how to exchange the stable back to native?

You can set the currency used to pay fees with using the feeCurrency field in a transaction. See also https://docs.celo.org/protocol/transaction/erc20-transaction-fees

palango avatar Feb 20 '23 13:02 palango

@jsvisa I have time to look deeper into this now. How did you pick the commits to include in this?

palango avatar Feb 20 '23 16:02 palango

@jsvisa I have time to look deeper into this now. How did you pick the commits to include in this?

Do you means the git commits? I pick up in manually

jsvisa avatar Feb 21 '23 06:02 jsvisa

Do you means the git commits? I pick up in manually

How did you select them? I see more tracing related commit in the upstream repository.

Also, I found out that the commit eth/tracers: package restructuring (#23857) in this PR differs from the upstream commit https://github.com/ethereum/go-ethereum/commit/6b9c77f06016eab761592baf5176ec343e400dc5

This makes the transactions undecodable, so it would be interesting to know where you found that particular commit.

palango avatar Mar 09 '23 11:03 palango

I'm putting this aside for now, there's higher priority things and one test still fails, for unclear reasons.

The test is TestBlockTracingConcurrentMapAccess which tests parallel tracing calls via the json rpc api. Below are some things I found out during debugging, as possible hints for the next person looking into this.

=== RUN   TestBlockTracingConcurrentMapAccess
Checking getExchangeSpenders. spenders = [0x000000000000000000000000000000000000d028]
Checking medianRate. numerator = 1000000000000000000000000  denominator = 1000000000000000000000000
Checking gas price minimum. cusdValue = 100000000
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x90 pc=0x105291b30]

goroutine 75 [running]:
github.com/celo-org/celo-blockchain/core/vm.(*StructLogger).CaptureState(0x14000242850, 0x0, 0x60, 0x186a0, 0x3, 0x20?, {0x0, 0x0, 0xa19?}, 0x1, ...)
	/Users/paul/Projects/celo-blockchain/core/vm/logger.go:211 +0x970
github.com/celo-org/celo-blockchain/core/vm.(*EVMInterpreter).Run(0x1400805c900, 0x140080152c0, {0x14008028800, 0x24, 0x40}, 0x1)
	/Users/paul/Projects/celo-blockchain/core/vm/interpreter.go:257 +0x7ac
github.com/celo-org/celo-blockchain/core/vm.(*EVM).StaticCall(0x1400805aa80, {0x105d20560, 0x140080549c0}, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...}, ...)
	/Users/paul/Projects/celo-blockchain/core/vm/evm.go:430 +0x4ec
github.com/celo-org/celo-blockchain/core/vm/vmcontext.(*SharedEVMRunner).Query(0x140077fc8a0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...}, ...)
	/Users/paul/Projects/celo-blockchain/core/vm/vmcontext/runner.go:102 +0x94
github.com/celo-org/celo-blockchain/contracts.(*BoundMethod).run(0x14000328c30, {0x105d274a0, 0x140077fc8a0}, {0x105ccf220, 0x14008054990}, 0x1, 0x14006fb01a8?, {0x14008060400, 0x1, 0x1})
	/Users/paul/Projects/celo-blockchain/contracts/contract_call.go:103 +0x258
github.com/celo-org/celo-blockchain/contracts.(*BoundMethod).Query(...)
	/Users/paul/Projects/celo-blockchain/contracts/contract_call.go:76
github.com/celo-org/celo-blockchain/contracts.GetRegisteredAddress({0x105d274a0, 0x140077fc8a0}, {0xaa, 0xb7, 0x4a, 0x77, 0xd8, 0xce, 0x26, 0xd2, ...})
	/Users/paul/Projects/celo-blockchain/contracts/registry.go:23 +0x13c
github.com/celo-org/celo-blockchain/contracts/reserve.TobinTax({0x105d274a0, 0x140077fc8a0}, {0xf1, 0x39, 0xb6, 0x59, 0xfb, 0x1b, 0xea, 0xe2, ...})
	/Users/paul/Projects/celo-blockchain/contracts/reserve/tobin_tax.go:29 +0x54
github.com/celo-org/celo-blockchain/contracts/reserve.ComputeTobinTax({0x105d274a0?, 0x140077fc8a0?}, {0xf1, 0x39, 0xb6, 0x59, 0xfb, 0x1b, 0xea, 0xe2, ...}, ...)
	/Users/paul/Projects/celo-blockchain/contracts/reserve/tobin_tax.go:56 +0x4c
github.com/celo-org/celo-blockchain/core/vm/vmcontext.TobinTransfer(0x1400805aa80, {0xf1, 0x39, 0xb6, 0x59, 0xfb, 0x1b, 0xea, 0xe2, 0x7d, ...}, ...)
	/Users/paul/Projects/celo-blockchain/core/vm/vmcontext/context.go:153 +0xec
github.com/celo-org/celo-blockchain/core/vm.(*EVM).Call(0x1400805aa80, {0x105d20560, 0x14008054948}, {0xbd, 0x3a, 0x2c, 0x79, 0x1d, 0xf9, 0x32, ...}, ...)
	/Users/paul/Projects/celo-blockchain/core/vm/evm.go:235 +0x4f4
github.com/celo-org/celo-blockchain/core.(*StateTransition).TransitionDb(0x14007e8fea0)
	/Users/paul/Projects/celo-blockchain/core/state_transition.go:568 +0x8ec
github.com/celo-org/celo-blockchain/core.ApplyMessage(0x105d17c18?, {0x105d2bba0, 0x14007e8fe00}, 0x1400807a5a0?, {0x105d274e0, 0x14008037ca0}, 0xec0eae7139df5d94?)
	/Users/paul/Projects/celo-blockchain/core/state_transition.go:242 +0x314
github.com/celo-org/celo-blockchain/eth/tracers.(*API).traceTx(0x140004d2510, {0x105d25c38, 0x140081ba140}, {0x105d2bba0?, 0x14007e8fe00?}, 0x1400802bf90, {0x105d17c18, 0x105d17c38, 0x140080653e0, 0x1400807a5a0, ...}, ...)
	/Users/paul/Projects/celo-blockchain/eth/tracers/api.go:975 +0x4fc
github.com/celo-org/celo-blockchain/eth/tracers.(*API).traceBlock.func1()
	/Users/paul/Projects/celo-blockchain/eth/tracers/api.go:645 +0x494
created by github.com/celo-org/celo-blockchain/eth/tracers.(*API).traceBlock
	/Users/paul/Projects/celo-blockchain/eth/tracers/api.go:632 +0x5b4
FAIL	github.com/celo-org/celo-blockchain/e2e_test	1.166s

The nil pointer dereference happens in the StructLogger.CaptureState call, where l.env is nil for some reason (https://github.com/jsvisa/celo-blockchain/blob/f56b115f10ce0e3417ce75da9c6beafa3b9cef91/core/vm/logger.go#L211). This means that StructLogger.CaptureStart has never been called on that instance. This should be done, when debug mode is enabled, see https://github.com/jsvisa/celo-blockchain/blob/f56b115f10ce0e3417ce75da9c6beafa3b9cef91/core/vm/evm.go#L238-L240 . So it seems that debug is set to false for some reason. However, at least the EVM instance used for tracing definitely has the debug flag set (https://github.com/jsvisa/celo-blockchain/blob/f56b115f10ce0e3417ce75da9c6beafa3b9cef91/eth/tracers/api.go#L970).

My best guess currently is that some object is shared between goroutines and this flag is overwritten incorrectly somewhere.

palango avatar Mar 16 '23 11:03 palango

@palango I will take some time in the next days to have a look.

jsvisa avatar Mar 16 '23 11:03 jsvisa

Looked into this a bit and I may have found some more information on what's going on here, though still don't have a thorough understanding/solution:

  • this not only fails for concurrent calls but also for tracing a block that has any transactions in it (used a test with a single transfer tx, making sequential calls)
    • @jsvisa were you able to trace any txs with the new functionality? Wondering if there's something particular about native transfers vs. any other transactions.
  • this fails even if the logic of tracing txs (in eth/tracers/api.go in traceBlock) happens sequentially (modified this temporarily to debug/test)
  • failure is caused in core/vm/evm.go in Call, specifically in the transfer call in L235. (This is before Capture.Start has been called)
    • transfer sets the env.Config.Debug to False to intentionally not trace within the scope of that call -- it's not clear to me exactly where/why Capture.State is being called within this scope
      • my current hypothesis/thing that I want to investigate further is that it may be due to the change in the PR of not passing in the env to CaptureState and instead using the calling' scope's env.StructLogger.evm, in conjunction with how the same EVM is reused (in SharedEVMRunner in TobinTransfer). It's unfortunately pretty hard to follow/debug this logic even in synchronous mode.

eelanagaraj avatar Mar 24 '23 17:03 eelanagaraj

@eelanagaraj after you cherry pick https://github.com/celo-org/celo-blockchain/pull/1978/commits/efbc25a3cc19bb227307513d81284d4e8359e252 the datarace issue resolved or not?

jsvisa avatar Apr 21 '23 14:04 jsvisa

BTW, seems some trace testcases in https://github.com/celo-org/celo-blockchain/blob/master/eth/tracers/tracers_test.go were removed, I think it is necessary to keep them

jsvisa avatar Apr 21 '23 14:04 jsvisa

Hey @jsvisa so the actual issue causing that test failure looks like it was caused by the bug fixed here: https://github.com/celo-org/celo-blockchain/pull/2061. In that PR, we also re-included the commented-out tests, to make sure that the frozen test output was then the same in this PR (to have a basis for comparison for this PR).

Let me know if something looks like it was missing/went wrong in the process of rebasing this PR though, but the test case outputs should now already be updated (from master)!

We are currently doing some more thorough testing on the go native tracer vs. the old one for a variety of txs and investigating some strange discrepancies with gasUsed values, but will keep you updated!

eelanagaraj avatar Apr 21 '23 14:04 eelanagaraj

@eelanagaraj thanks for your quick reply, seems the testcases(callTracer tester) more moved inside the internal dir, so it's ok.

jsvisa avatar Apr 21 '23 14:04 jsvisa

@hbandura thanks for your explanation.

eg:

  "gas": "0x186a0",
   "gasUsed": "0xffee3628",

Does this means gas in the CELO native token, but gasUsed is in celo stable token? If that's the case, how do we distinguish between native and stable, and how to exchange the stable back to native?

Thank you in advance.

And does this issue also resolved?

jsvisa avatar Apr 21 '23 14:04 jsvisa

Hey @jsvisa ! That's what I'm currently looking into -- the current working theory is that this actually represents a negative value (2s complement; this may have not been an unsigned int in the past and apparently we have had negative gasUsed values in these traces before). These occurrences seem to correlate strongly with calls to the transfer precompile (0x00000000000000000000000000000000000000fd), but I'm not totally sure why that is.

I'll let you know if/when I understand if negative gasUsed values are "correct"/expected (possibly the case in the past, but that's a bit divergent from ethereum) & if I can come up with a more useful mini-repro of this behavior in a unit test. 🙏

eelanagaraj avatar Apr 24 '23 11:04 eelanagaraj

Still not 100% what's going on with the underflows/negative gas values, but it looks like that is not a new thing with this PR. The mismatches I found between the callTraces' gasUsed values between the old tracer & this PR are accounted for by a change from uint -> uint64 in the gasUsed vals, which are apparent during the underflows.

Once this PR is merged (adds a few more Celo-specific tracing tests), I'll update this PR and it should be ready to merge from my view. Thanks for your patience 🙏

eelanagaraj avatar Apr 28 '23 15:04 eelanagaraj

Codecov Report

Patch coverage: 66.64% and project coverage change: +0.94 :tada:

Comparison is base (71bdbcf) 54.30% compared to head (493743e) 55.24%.

:exclamation: Current head 493743e differs from pull request most recent head 7f2410b. Consider uploading reports for the commit 7f2410b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1978      +/-   ##
==========================================
+ Coverage   54.30%   55.24%   +0.94%     
==========================================
  Files         692      675      -17     
  Lines      115642   113693    -1949     
==========================================
+ Hits        62795    62810      +15     
+ Misses      49014    47028    -1986     
- Partials     3833     3855      +22     
Impacted Files Coverage Δ
cmd/devp2p/internal/ethtest/transaction.go 0.00% <0.00%> (ø)
cmd/evm/runner.go 0.00% <0.00%> (ø)
cmd/evm/staterunner.go 0.00% <0.00%> (ø)
cmd/geth/chaincmd.go 0.00% <0.00%> (ø)
cmd/geth/config.go 0.00% <0.00%> (ø)
cmd/geth/main.go 21.39% <ø> (+0.91%) :arrow_up:
cmd/geth/usage.go 10.90% <ø> (ø)
cmd/utils/flags.go 2.56% <0.00%> (ø)
consensus/istanbul/utils.go 47.10% <ø> (+1.13%) :arrow_up:
contracts/currency/currency.go 55.00% <ø> (ø)
... and 61 more

... and 37 files with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar May 03 '23 14:05 codecov[bot]

  • unit tests that don't work with the new tracer package structure have been moved to e2e
    • unit tests look like they pass but are failing CI due to this issue https://github.com/celo-org/celo-blockchain-planning/issues/65
  • we understand what's going on with the underflows (has to do with reused state on specific unmetered calls; this doesn't have to do with this PR and is tracked in these two issues: https://github.com/celo-org/celo-blockchain/issues/2078, https://github.com/celo-org/celo-blockchain-planning/issues/66)
  • tested a bunch of txs against the old deployment in blockscout

I think we just need second reviews from me & @palango, and any additional blockscout testing that @carterqw2 wants to do!

eelanagaraj avatar May 04 '23 09:05 eelanagaraj

Continued in https://github.com/celo-org/celo-blockchain/pull/2137

palango avatar Jun 22 '23 12:06 palango