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

bug when debuging transaction #2582

Closed
2 tasks done
henry-hz opened this issue Aug 3, 2022 · 12 comments
Closed
2 tasks done

bug when debuging transaction #2582

henry-hz opened this issue Aug 3, 2022 · 12 comments
Assignees
Labels
C-cast Command: cast T-bug Type: bug
Milestone

Comments

@henry-hz
Copy link

henry-hz commented Aug 3, 2022

Component

Cast

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (64fe4ac 2022-07-26T00:04:05.891537523Z)

What command(s) is the bug in?

cast run --debug

Operating System

Linux

Describe the bug

RUST_BACKTRACE=full cast run --debug [my-anvil-transaction]                                                                                                         16:19:09
Executing previous transactions from the block.
The application panicked (crashed).
Message:  index out of bounds: the len is 0 but the index is 0
Location: evm/src/debug.rs:67

This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __libc_start_main<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
zsh: IOT instruction  RUST_BACKTRACE=full cast run --debug 
@henry-hz henry-hz added the T-bug Type: bug label Aug 3, 2022
@onbjerg
Copy link
Member

onbjerg commented Aug 3, 2022

What chain is this?

@onbjerg onbjerg added the C-cast Command: cast label Aug 3, 2022
@onbjerg onbjerg self-assigned this Aug 3, 2022
@onbjerg onbjerg added this to the v1.0.0 milestone Aug 3, 2022
@henry-hz
Copy link
Author

henry-hz commented Aug 4, 2022

@onbjerg thanks for the follow-up. Please, is there a way to generate an output exaclty the 'dapp.sol.json' ? so I can use the 'seth run --debug [tx]' meanwhile until the debugger becomes stable.

@mattsse
Copy link
Member

mattsse commented Aug 4, 2022

@onbjerg thanks for the follow-up. Please, is there a way to generate an output exaclty the 'dapp.sol.json' ? so I can use the 'seth run --debug [tx]' meanwhile until the debugger becomes stable.

this tx is not on mainnet, on which chain is it?
no way to debug otherwise

@henry-hz
Copy link
Author

henry-hz commented Aug 4, 2022

using anvil, or other local network. As I posted here , it can be in any EVM compatible network, once we have the sources in the local machine we can bypass the etherscan dependency to download them, and debug on any network with the full source code locally

@onbjerg
Copy link
Member

onbjerg commented Aug 4, 2022

I think you're misunderstanding: we can't find the transaction you reference in this issue. What chain is it on, so we can try to reproduce the error and fix it?

@henry-hz
Copy link
Author

henry-hz commented Aug 4, 2022

sorry, it was only an example, this transaction was on my machine [anvil]

@onbjerg
Copy link
Member

onbjerg commented Aug 4, 2022

Can you provide some steps on how to generate the transaction? E.g. what the transaction did. It looks like some data is missing, so the question is whether this is a bug in Anvil or in Cast.

@henry-hz
Copy link
Author

henry-hz commented Aug 4, 2022

yes,

{
  "deployedTo": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
  "deployer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
  "transactionHash": "0x779b4e00348b4d2ba53bd58f5b81096724d8e93e2f703a18f4b77dc3b2ed4a86"
}
0x5FbDB2315678afecb367f032d93F642f64180aa3
transaction output
{
  "blockHash": "0xd4c816a715937761c5081ecffeb0f9a1ff3d0443af83d92cabb33ca8e8a31b29",
  "blockNumber": "0x2",
  "contractAddress": null,
  "cumulativeGasUsed": "0xef117",
  "effectiveGasPrice": "0xa685e3f9",
  "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
  "gasUsed": "0xef117",
  "logs": [
    {
      "address": "0x8ff3801288a85ea261e4277d44e1131ea736f77b",
      "blockHash": "0xd4c816a715937761c5081ecffeb0f9a1ff3d0443af83d92cabb33ca8e8a31b29",
      "blockNumber": "0x2",
      "data": "0x",
      "logIndex": "0x0",
      "removed": false,
      "topics": [
        "0xce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed94",
        "0x000000000000000000000000a16e02e87b7454126e5e10d957a927a7f5b5d2be"
      ],
      "transactionHash": "0xaf9ca3b91bf937dc9f57bad33c39c3ed1a21232b22c5bdb66918f4826b6e5169",
      "transactionIndex": "0x0",
      "transactionLogIndex": "0x0"
    },
    {
      "address": "0x8ff3801288a85ea261e4277d44e1131ea736f77b",
      "blockHash": "0xd4c816a715937761c5081ecffeb0f9a1ff3d0443af83d92cabb33ca8e8a31b29",
      "blockNumber": "0x2",
      "data": "0x",
      "logIndex": "0x1",
      "removed": false,
      "topics": [
        "0xce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed94",
        "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266"
      ],
      "transactionHash": "0xaf9ca3b91bf937dc9f57bad33c39c3ed1a21232b22c5bdb66918f4826b6e5169",
      "transactionIndex": "0x0",
      "transactionLogIndex": "0x1"
    }
  ],
  "logsBloom": "0x00000000000000000000000010000000000000000000020000000000000000000000000800000000000000000000000000000000000000080000002000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000200000000000000000000000002000000000000000000000000000000000000000000000000000000000040000000001000000000000000000",
  "status": "0x1",
  "to": "0x5fbdb2315678afecb367f032d93f642f64180aa3",
  "transactionHash": "0xaf9ca3b91bf937dc9f57bad33c39c3ed1a21232b22c5bdb66918f4826b6e5169",
  "transactionIndex": "0x0"
}
transaction output
{
  "blockHash": "0xf8130324f4daccce246a25ad931aadceea4915b7e750989ce16d4f92e78ec98b",
  "blockNumber": "0x3",
  "contractAddress": null,
  "cumulativeGasUsed": "0xd6521",
  "effectiveGasPrice": "0xa0f47573",
  "from": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
  "gasUsed": "0xd6521",
  "logs": [],
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "status": "0x1",
  "to": "0x5fbdb2315678afecb367f032d93f642f64180aa3",
  "transactionHash": "0xee7a8607dfab1253945a33e0856f6f84ba675338bfc561fb0aff07c0614e7f47",
  "transactionIndex": "0x0"
}
0x280de1b81BE475E9c082692ddd53aEb823E72A01
0x8Ff3801288a85ea261E4277d44E1131Ea736F77B

@onbjerg
Copy link
Member

onbjerg commented Aug 4, 2022

So the transaction just deploys a contract?

@henry-hz
Copy link
Author

henry-hz commented Aug 5, 2022

almost, I am following the makerdao dss pattern, they did:

  1. deploy the dss_deploy.sol
  2. deploy the factories [vatFab, jugFab, etc..], that are responsible to create the vat instance]
  3. add the fabs to the deploy contract
  4. run the deploy function, so instances are created
  5. change auth between contracts on-chain

The example above is a simplification of their deployment, once in my case the fabs are already on-chain, so I deploy in two phases, the deploy contract and after I call the deploy function to create and configure the target contracts.

@henry-hz
Copy link
Author

henry-hz commented Aug 8, 2022

@onbjerg , I think it's my fault, sorry. Seems the version was not updated. I saw 0.2.0 and thought that it was the last version, but after running forgeryup today, I got a 0.2.0 with a new build that worked. Let me suggest to use an incremental build number and make a small request once a day to check if there is a new version [as flutter does and shows a notification].

forge --version                                                                                         09:52:34 
forge 0.2.0 (64fe4ac 2022-07-26T00:04:05.891537523Z)                                                                                  
                                                                                                                                      
~/sigma/dex master ❯ forgeryup                                                                                               09:52:42 
zsh: command not found: forgeryup                                                                                                     
                                                                                                                                      
~/sigma/dex master ❯ foundryup                                                                                               09:52:48 
foundryup: installing foundry (version nightly, tag nightly-92f8951409034fd597ad08a386474af8d2d8868a)                                 
foundryup: downloading latest forge, cast and anvil                                                                                   
############################################################################################################################### 100.0%
foundryup: downloading manpages                                                                                                       
############################################################################################################################### 100.0%
foundryup: installed - forge 0.2.0 (92f8951 2022-08-08T00:03:54.483346829Z)                                                           
foundryup: installed - cast 0.2.0 (92f8951 2022-08-08T00:03:54.483346829Z)                                                            
foundryup: installed - anvil 0.1.0 (92f8951 2022-08-08T00:03:54.482691017Z)                                                           
foundryup: done                                                                  

@onbjerg
Copy link
Member

onbjerg commented Aug 8, 2022

@henry-hz We're still running nightlies only (new release every night), stable version numbers and a method to check for updates is coming for 1.0.0. Glad to hear it was solved, though :)

@onbjerg onbjerg closed this as completed Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cast Command: cast T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests

3 participants