-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
SUMMARY
Ignition simulates transactions before sending them to chain. And sapphire uses msg.sender as address(0) for simulated calls, which breaks
ISSUE TYPE
- Bug Report
STEPS TO REPRODUCE
- Setup hardhat project with following files:
Files
hardhat.config.ts
import type { HardhatUserConfig } from "hardhat/config";
import "@oasisprotocol/sapphire-hardhat";
import "@nomicfoundation/hardhat-toolbox";
import "solidity-coverage";
import { vars } from "hardhat/config";
const config: HardhatUserConfig = {
solidity: "0.8.20",
networks: {
sapphire: {
url: 'https://sapphire.oasis.io',
chainId: 23294,
accounts: [
vars.get('SAPPHIRE_DEPLOYER')
]
}
}
};
export default config;contracts/OwnerTester.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol";
contract OwnerTester is Ownable {
constructor(address _owner) Ownable(_owner) {}
uint value;
function setValue(uint _value) onlyOwner public {
value = _value;
}
}ignition/modules/Ownable.ts
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"
export default buildModule("Ownable", (m) => {
const deployer = m.getAccount(0);
const ownable = m.contract('OwnerTester', [deployer])
m.call(ownable, 'setValue', [1]);
return {
ownable
}
})- run
npx hardhat ignition deploy ignition/modules/Ownable.ts --network sapphireACTUAL RESULTS
✔ Confirm deploy to network sapphire (23294)? … yes
Hardhat Ignition 🚀
Resuming existing deployment from ./ignition/deployments/chain-23294
Deploying [ Ownable ]
Batch #1
Executed Ownable#OwnerTester
Batch #2
Failed Ownable#OwnerTester.setValue
[ Ownable ] failed ⛔
Futures failed during execution:
- Ownable#OwnerTester.setValue: Simulating the transaction failed with error: Reverted with custom error OwnableUnauthorizedAccount("0x0000000000000000000000000000000000000000")
To learn how to handle these errors: https://hardhat.org/ignition-errors
EXPECTED RESULTS
✔ Confirm deploy to network sapphire (23294)? … yes
Hardhat Ignition 🚀
Resuming existing deployment from ./ignition/deployments/chain-23294
Deploying [ Ownable ]
Batch #1
Executed Ownable#OwnerTester
Batch #2
Executed Ownable#OwnerTester.setValue
[ Ownable ] successfully deployed 🚀
Deployed Addresses
Ownable#OwnerTester - 0x5FbDB2315678afecb367f032d93F642f64180aa3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels