Skip to content

Commit 9d5ecff

Browse files
committed
Disable collections by default
1 parent 24b4aa6 commit 9d5ecff

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

contracts/script/L2Genesis.s.sol

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,18 @@ contract L2Genesis is Script {
210210
ethscriptions.registerProtocol("erc-20", Predeploys.TOKEN_MANAGER);
211211
console.log("Registered erc-20 protocol handler:", Predeploys.TOKEN_MANAGER);
212212

213-
// Register the CollectionsManager as the handler for collections protocol
214-
ethscriptions.registerProtocol("collections", Predeploys.COLLECTIONS_MANAGER);
215-
console.log("Registered collections protocol handler:", Predeploys.COLLECTIONS_MANAGER);
213+
// Check environment variable for collections
214+
// Default to true so forge tests work (they don't go through genesis_generator.rb)
215+
// Production explicitly sets ENABLE_COLLECTIONS=false
216+
bool enableCollections = vm.envOr("ENABLE_COLLECTIONS", true);
217+
218+
if (enableCollections) {
219+
// Register the CollectionsManager as the handler for collections protocol
220+
ethscriptions.registerProtocol("collections", Predeploys.COLLECTIONS_MANAGER);
221+
console.log("Registered collections protocol handler:", Predeploys.COLLECTIONS_MANAGER);
222+
} else {
223+
console.log("Collections protocol not registered (ENABLE_COLLECTIONS=false)");
224+
}
216225
}
217226

218227
/// @notice Deploy L1Block contract (stores L1 block attributes)

lib/genesis_generator.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ def run_forge_genesis_script!
9191
end
9292

9393
should_perform_genesis_import = ENV.fetch('PERFORM_GENESIS_IMPORT', 'true') == 'true'
94-
94+
# Collections default to true in forge (for tests), but we disable in dev/prod via env files
95+
enable_collections = ENV.fetch('ENABLE_COLLECTIONS', 'false') == 'true'
96+
9597
# Build the forge script command
96-
cmd = "cd #{contracts_dir} && PERFORM_GENESIS_IMPORT=#{should_perform_genesis_import} forge script '#{script_path}:L2Genesis'"
98+
cmd = "cd #{contracts_dir} && PERFORM_GENESIS_IMPORT=#{should_perform_genesis_import} ENABLE_COLLECTIONS=#{enable_collections} forge script '#{script_path}:L2Genesis'"
9799

98100
log "Executing: #{cmd}"
99101
log nil

0 commit comments

Comments
 (0)