Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Deployer doesn't use correct deployer address #21

Closed
devtooligan opened this issue Jul 31, 2022 · 0 comments · Fixed by #22
Closed

Deployer doesn't use correct deployer address #21

devtooligan opened this issue Jul 31, 2022 · 0 comments · Fixed by #22

Comments

@devtooligan
Copy link
Contributor

devtooligan commented Jul 31, 2022

example:

contract Testes is Test {
  function setUp() public {
    console.log(address(this)); // ==> 0xb4c79dab8f259c7aee6e5b2aa729821864227e84
    vm.startPrank(0xBADBABE);
    t = HuffDeployer.deploy("ownable");
    console.log(t.owner()); // ==> 0xb7ae1a7049f30ecd8ff4d0328206652ecceca25f
 }
}

Was testing out TSOwnable.huff which SSTORE's the caller as the owner in the constructor (I've confirmed this in the debugger) and noticed that the deployer address gets lost along the way. The address that gets used is the address of the HuffConfig contract.

I did some sleuthing here are my logs:

Logs:
  0xb4c79dab8f259c7aee6e5b2aa729821864227e84, address(this) from setUp() in test before HuffDeployer is run
  0x000000000000000000000000000000000badbabe, vm.startPrank(address(0xBADBABE)) called just before HuffDeployer
  0xb4c79dab8f259c7aee6e5b2aa729821864227e84, address(this) from HuffDeployer.deploy()
  0xb7ae1a7049f30ecd8ff4d0328206652ecceca25f, address(this) from HuffConfig.deploy(), just before create()
  0xb7ae1a7049f30ecd8ff4d0328206652ecceca25f, t.owner() from setUp() in test setup after HuffDeployer complete

So it appears that vm.startPrank doesn't work on the call to HuffDeployer, then when HuffDeployer calls HuffConfig, a whole new other address is used for the deployment.

Solution, idk why we lose that pranked address when calling HuffDeployer. If we had access to that, we could just pass it to HuffConfig.deploy and then vm.prank just before we call create. But if we can't get the pranked address in HuffDeployer.deploy then I guess we set up a new config() option to assign deployer or smthg...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant