Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lit-api-server/blockchain/lit_node_express/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ update_anvil: compile

update_sepolia: compile
cd $(RUST_PROJECT) && cargo build --bin contract_deployer
$(DEPLOYER_BIN) --action=update --network=base-sepolia --abifolder=artifacts/contracts --secret=$(DEPLOYER_SECRET) --address=$(address)
$(DEPLOYER_BIN) --action=update --network=base-sepolia --abifolder=artifacts/contracts --secret=$(DEPLOYER_SECRET) --address=$(address) --removals=diamond-removals.json

update_base: compile
cd $(RUST_PROJECT) && cargo build --bin contract_deployer
$(DEPLOYER_BIN) --action=update --network=base --abifolder=artifacts/contracts --secret=$(BASE_DEPLOYER_SECRET) --address=$(address)
$(DEPLOYER_BIN) --action=update --network=base --abifolder=artifacts/contracts --secret=$(BASE_DEPLOYER_SECRET) --address=$(address) --removals=diamond-removals.json

# Propose diamond update via Safe multisig (Base mainnet).
# Usage: make propose_update_base address=0x... safe=0x...
Expand All @@ -78,7 +78,8 @@ propose_update_base: compile
--abifolder=artifacts/contracts \
--secret=$(BASE_DEPLOYER_SECRET) \
--address=$(address) \
--output=diamond_cut_proposal.json
--output=diamond_cut_proposal.json \
--removals=diamond-removals.json
npx hardhat propose-diamond-cut \
--safe $(safe) \
--proposal diamond_cut_proposal.json \
Expand All @@ -92,7 +93,8 @@ propose_update_sepolia: compile
--abifolder=artifacts/contracts \
--secret=$(DEPLOYER_SECRET) \
--address=$(address) \
--output=diamond_cut_proposal.json
--output=diamond_cut_proposal.json \
--removals=diamond-removals.json
npx hardhat propose-diamond-cut \
--safe $(safe) \
--proposal diamond_cut_proposal.json \
Expand Down
10 changes: 10 additions & 0 deletions lit-api-server/blockchain/lit_node_express/diamond-removals.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"_comment": "Functions to Remove from the AccountConfig diamond on the next upgrade. The deployer only auto-computes Replace/Add; a selector is removed only if it is BOTH listed here AND detected as orphaned by the upgrade (absent from every new managed facet ABI). See tasks/../deployer/diamond.rs plan_removals.",
"removals": [
{
"signature": "backfillPkpOwners(address[],uint256[])",
"selector": "0x41275609",
"reason": "Spent one-time #575 PKP owner backfill; removed after the migration completed on Base mainnet (all PKPs bound, 0 unbound/conflicts). Requires the WritesFacet build that no longer declares it."
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//! secret: optional; deployer private key (hex). If blank or omitted, uses default Anvil dev secret.
//! address: required for update and propose-update actions; the diamond contract address.
//! output: optional; path for the proposal JSON file (propose-update only). Defaults to diamond_cut_proposal.json.
//! removals: optional; path to the selector-removals manifest (update/propose-update). Defaults to diamond-removals.json; missing file = no removals.

use alloy::primitives::Address;
use lit_contracts_minimal_generator::args::{get_network_and_chain_id, parse_named_args};
Expand Down Expand Up @@ -42,6 +43,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
eprintln!(
" --output proposal JSON output path (propose-update only, default: diamond_cut_proposal.json)"
);
eprintln!(
" --removals selector-removals manifest path (update/propose-update, default: diamond-removals.json)"
);
std::process::exit(1);
};

Expand Down Expand Up @@ -107,10 +111,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
);

let diamond_address = parse_diamond_address(&named, usage);
let removals = removals_path(&named);

update_diamond(rpc_url, chain_id, &abis_folder, secret, diamond_address)
.await
.expect("Failed to update diamond");
update_diamond(
rpc_url,
chain_id,
&abis_folder,
secret,
diamond_address,
&removals,
)
.await
.expect("Failed to update diamond");
}
if action == "propose-update" {
println!(
Expand All @@ -123,6 +135,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.get("output")
.cloned()
.unwrap_or_else(|| "diamond_cut_proposal.json".to_string());
let removals = removals_path(&named);

propose_update_diamond(
rpc_url,
Expand All @@ -131,13 +144,25 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
secret,
diamond_address,
&output,
&removals,
)
.await
.expect("Failed to propose diamond update");
}
Ok(())
}

/// Path to the selector-removals manifest. Defaults to `diamond-removals.json`
/// in the working directory (the contracts project dir when run via the
/// Makefile). A missing file means "no removals" — the deployer keeps its prior
/// Replace/Add-only behavior.
fn removals_path(named: &std::collections::HashMap<String, String>) -> String {
named
.get("removals")
.cloned()
.unwrap_or_else(|| "diamond-removals.json".to_string())
}

fn parse_diamond_address(
named: &std::collections::HashMap<String, String>,
usage: impl Fn(),
Expand Down
Loading
Loading