Skip to content

Unable to getCode of contract with library function call (linked library)?

Notifications You must be signed in to change notification settings

8gen/foundry-library-linking-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Error with vm.getCode of contract that contains a library's function call

How to repeat?

forge build && forge script script/test.s.sol
[⠢] Compiling...
No files changed, compilation skipped
[⠢] Compiling...
No files changed, compilation skipped
Traces:
  [217883] → new GetCode@0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496
    └─ ← 867 bytes of code

  [30319] GetCode::run()
    ├─ [0] VM::getCode(Counter.sol:CounterOk) [staticcall]
    │   └─ ← 0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000145608060405234801561001057600080fd5b50610125806100206000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c80633fb5c1cb1460415780638381f58a146052578063d09de08a14606c575b600080fd5b6050604c3660046095565b6072565b005b605a60005481565b60405190815260200160405180910390f35b60506081565b607b60018260c3565b60005550565b600080549080608e8360d9565b9190505550565b60006020828403121560a657600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111560d35760d360ad565b92915050565b60006001820160e85760e860ad565b506001019056fea264697066735822122029deface26ebdef1deb51750a95dc59aa6a25fd1e67c97b5d3071cbf4c56284564736f6c63430008110033000000000000000000000000000000000000000000000000000000
    ├─ [0] console::log(0x608060405234801561001057600080fd5b50610125806100206000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c80633fb5c1cb1460415780638381f58a146052578063d09de08a14606c575b600080fd5b6050604c3660046095565b6072565b005b605a60005481565b60405190815260200160405180910390f35b60506081565b607b60018260c3565b60005550565b600080549080608e8360d9565b9190505550565b60006020828403121560a657600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111560d35760d360ad565b92915050565b60006001820160e85760e860ad565b506001019056fea264697066735822122029deface26ebdef1deb51750a95dc59aa6a25fd1e67c97b5d3071cbf4c56284564736f6c63430008110033) [staticcall]
    │   └─  ()
    ├─ [0] VM::getCode(Counter.sol:CounterBad) [staticcall]
    │   └─ ← "No bytecode for contract. Is it abstract or unlinked?"
    └─ ← "No bytecode for contract. Is it abstract or unlinked?"


Gas used: 30319

== Logs ==
  0x608060405234801561001057600080fd5b50610125806100206000396000f3fe6080604052348015600f57600080fd5b5060043610603c5760003560e01c80633fb5c1cb1460415780638381f58a146052578063d09de08a14606c575b600080fd5b6050604c3660046095565b6072565b005b605a60005481565b60405190815260200160405180910390f35b60506081565b607b60018260c3565b60005550565b600080549080608e8360d9565b9190505550565b60006020828403121560a657600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111560d35760d360ad565b92915050565b60006001820160e85760e860ad565b506001019056fea264697066735822122029deface26ebdef1deb51750a95dc59aa6a25fd1e67c97b5d3071cbf4c56284564736f6c63430008110033
Error:

About

Unable to getCode of contract with library function call (linked library)?

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published