Skip to content

Conversation

@0xp3th1um
Copy link
Contributor

@0xp3th1um 0xp3th1um commented May 14, 2025

The script verify.py has been tested on the Sepolia testnet. Unfortunately, there is neither chainlog nor DssExeclib there.
We deployed a new DssExeclib at 0x0496AbA1f2CD4038cC486993f5CCF97851AE26d3 that can be used instead.
In order to test the script you can deploy a simple Spell contract containing only a counter i.e.

uint256 internal constant NONCE = magicNumber;

You can increase the counter each time you deploy a new contract for testing because etherscan will detect the bytecode and verify it automatically otherwise.

Additionally, in order to have a successfull deployment, DssExec.sol has to be edited accordingly:
line 47: PauseAbstract /* immutable */ public pause;
line 68: // pause = PauseAbstract(log.getAddress("MCD_PAUSE"));

Sepolia related rpc and api-key entries need to be added to `foundy.toml:

[rpc_endpoints]
mainnet = "${ETH_RPC_URL}"
sepolia = "${ETH_RPC_URL}"

[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY}" }
sepolia = { key = "${ETHERSCAN_API_KEY}" }

and in verify.py the sepolia chain-id has to be added:

ETHERSCAN_SUBDOMAINS = {
    '1': '',
    '11155111': 'sepolia.'
}

In order to deploy the spell you can use the following command

forge create src/DssSpell.sol:DssSpell \
--rpc-url $ETH_RPC_URL \
--libraries ./lib/dss-exec-lib/src/DssExecLib.sol:DssExecLib:0x0496AbA1f2CD4038cC486993f5CCF97851AE26d3 \
--gas-limit 5000000 \
--use 0.8.16 \
--force \
--broadcast

@0xp3th1um 0xp3th1um self-assigned this May 14, 2025
@0xp3th1um 0xp3th1um marked this pull request as draft May 14, 2025 08:44
@0xp3th1um 0xp3th1um marked this pull request as ready for review May 20, 2025 11:46
@amusingaxl amusingaxl self-requested a review May 20, 2025 19:44
foundry.toml Outdated
Comment on lines 21 to 22
[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY}" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to remove this, because it's breaking CI.
Please check the implications of removing this section.

Copy link
Contributor

@SidestreamColdMelon SidestreamColdMelon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setup

  1. Temporary modified foundry.toml to add sepolia = "${ETH_RPC_URL}" in the end
  2. Temporary modified DssExec.sol to replace log.getAddress("MCD_PAUSE") with address(0)
  3. Temporary modified verify.py to add '11155111': 'sepolia.' into ETHERSCAN_SUBDOMAINS
  4. Temporary modified DssExecLib.address to contain 0x0496AbA1f2CD4038cC486993f5CCF97851AE26d3
  5. Temporary removed libraries array from foundry.toml
  6. Cleaned up DssSpell.sol
  7. Exported ETHERSCAN_API_KEY and ETH_RPC_URL with sepolia-specific url
  8. Activated python environment (source ~/path/to/venv/bin/activate)
  9. Deployed spell with forge create --no-cache --interactive src/DssSpell.sol:DssSpell --libraries ./lib/dss-exec-lib/src/DssExecLib.sol:DssExecLib:0x0496AbA1f2CD4038cC486993f5CCF97851AE26d3 --broadcast

Results

  1. Deployed contract is unverified
  2. ✅ Executing make verify addr=0xF4cBfbf1987d3E30436c6Bee521D421cBF4f5060 verified both DssSpell and its action (DssSpellAction)
  3. ✅ Rerunning step 9. above after modifying optimizer = true and optimzier_runs = 200 deployed another unverified contract
  4. ✅ Executing make verify addr=0x0188B03a839Eb51675Ad6398EC3579790473e469 verified both DssSpell and DssSpellAction

Example logs

./scripts/verify.py DssSpell 0xF4cBfbf1987d3E30436c6Bee521D421cBF4f5060
Obtaining chain ID... 
CHAIN_ID: 11155111
No DssExecLib configured in foundry.toml
Trying to read DssExecLib.address...
Using library DssExecLib at address 0x0496AbA1f2CD4038cC486993f5CCF97851AE26d3

Verifying DssSpell at 0xF4cBfbf1987d3E30436c6Bee521D421cBF4f5060...
Sending verification request...
Verification request submitted with GUID: 3j6t9dgwu2tutq8qiizbteb8p4dzbifmnca8uyvidgqzgcwvug
Sending verification request...
Pending in queue
Waiting for 15 seconds for Etherscan to process the request...
Sending verification request...
Contract verified successfully at https://sepolia.etherscan.io/address/0xF4cBfbf1987d3E30436c6Bee521D421cBF4f5060#code

Verifying DssSpellAction at 0x27B4e84E4496E503a46885aAE25E50947ff81aaf...
Sending verification request...
Verification request submitted with GUID: vffuksm37srh6jyt21wh4n8wb18xzrqjrhfsskzphychmhqjrp
Sending verification request...
Pending in queue
Waiting for 15 seconds for Etherscan to process the request...
Sending verification request...
Contract verified successfully at https://sepolia.etherscan.io/address/0x27B4e84E4496E503a46885aAE25E50947ff81aaf#code

Verification complete!

Comment on lines +15 to +17
libraries = [
"./lib/dss-exec-lib/src/DssExecLib.sol:DssExecLib:0x8De6DDbCd5053d32292AAA0D2105A32d108484a6"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: It's technically out of scope of this PR to (partially) move DssExecLib address into foundry.toml. But fine for me to keep it, until the next PR is merged. No action required

@amusingaxl amusingaxl requested a review from oddaf June 5, 2025 15:27
@amusingaxl amusingaxl assigned amusingaxl and unassigned 0xp3th1um Jun 5, 2025
Copy link
Contributor

@SidestreamColdMelon SidestreamColdMelon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At commit 1680435:

At commit e55b011:

  • make check-deployed-spell works as expected

Copy link
Member

@oddaf oddaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, test run on Sepolia:

Obtaining chain ID... 
CHAIN_ID: 11155111
Using library DssExecLib at address 0x0496AbA1f2CD4038cC486993f5CCF97851AE26d3

Verifying DssSpell at 0x36B072ed8AFE665E3Aa6DaBa79Decbec63752b22...
Sending verification request...
Verification request submitted with GUID: rjahmnevgrhf7ctzkddyeueheugt9pee24xebbz55qzhqxupcz
Sending verification request...
Pending in queue
Waiting for 15 seconds for Etherscan to process the request...
Sending verification request...
Contract verified successfully at https://sepolia.etherscan.io/address/0x36B072ed8AFE665E3Aa6DaBa79Decbec63752b22#code

Verifying DssSpellAction at 0xF7A3ed7721c46C7Fa2109a09CA64718B3786Ad37...
Sending verification request...
Unable to locate ContractCode at 0xF7A3ed7721c46C7Fa2109a09CA64718B3786Ad37
Waiting for 15 seconds for the network to update...
Sending verification request...
Verification request submitted with GUID: fvm47wfsts6kmrd3d3edpadztewnsh1thbajiyw1aiizyjd85n
Sending verification request...
Pending in queue
Waiting for 15 seconds for Etherscan to process the request...
Sending verification request...
Contract verified successfully at https://sepolia.etherscan.io/address/0xF7A3ed7721c46C7Fa2109a09CA64718B3786Ad37#code

Verification complete!

@amusingaxl amusingaxl merged commit dc8e3c7 into master Jun 7, 2025
2 of 3 checks passed
@amusingaxl amusingaxl deleted the revamp-verify.py branch June 7, 2025 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants