Skip to content

Commit fc2ca88

Browse files
Copilotkatspaugh
andcommitted
Change supported versions to 1.3.0 L2 and 1.4.1 L2
Co-authored-by: katspaugh <381895+katspaugh@users.noreply.github.com>
1 parent d4b7370 commit fc2ca88

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

docs/CUSTOM_MASTERCOPY_GUIDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
The Safe protocol-kit now supports Safe contracts that use custom-deployed L2 mastercopies (also called singletons), as long as the mastercopy bytecode exactly matches an official Safe L2 version. This enables using the SDK on custom networks, testnets, or with independently deployed Safe contracts.
66

7-
**Supported versions**: Only **1.1.1 L2** and **1.3.0 L2** mastercopies are supported for bytecode matching.
7+
**Supported versions**: Only **1.3.0 L2** and **1.4.1 L2** mastercopies are supported for bytecode matching.
88

99
## How It Works
1010

@@ -14,7 +14,7 @@ When you initialize a Safe instance, the SDK will:
1414
2. **Fallback mechanism**: If the VERSION() call fails:
1515
- Read the mastercopy address from storage slot 0 of the Safe proxy
1616
- Fetch the bytecode of the mastercopy contract
17-
- Compare the bytecode hash against supported Safe L2 versions (1.1.1 L2 and 1.3.0 L2)
17+
- Compare the bytecode hash against supported Safe L2 versions (1.3.0 L2 and 1.4.1 L2)
1818
- If a match is found, use that version to initialize the SDK
1919
- If no match is found, fall back to the default version (1.3.0)
2020

@@ -47,7 +47,7 @@ For the mastercopy matching to work, the following conditions must be met:
4747

4848
1. **Exact bytecode match**: The mastercopy bytecode must be byte-for-byte identical to an official Safe L2 deployment
4949
2. **Contract must be deployed**: Both the Safe proxy and the mastercopy must be deployed on the network
50-
3. **Supported version**: The mastercopy must match one of the supported Safe L2 versions (**1.1.1 L2** or **1.3.0 L2** only)
50+
3. **Supported version**: The mastercopy must match one of the supported Safe L2 versions (**1.3.0 L2** or **1.4.1 L2** only)
5151

5252
## Benefits
5353

@@ -59,13 +59,13 @@ For the mastercopy matching to work, the following conditions must be met:
5959
## What Gets Detected
6060

6161
The mastercopy matching detects:
62-
- **Safe version**: Which Safe L2 contract version (1.1.1 or 1.3.0)
62+
- **Safe version**: Which Safe L2 contract version (1.3.0 or 1.4.1)
6363
- **Singleton type**: Always L2 singleton
6464
- **Mastercopy address**: The address of the matched mastercopy
6565

6666
## Limitations
6767

68-
- **Only L2 versions supported**: Only 1.1.1 L2 and 1.3.0 L2 mastercopies are supported
68+
- **Only L2 versions supported**: Only 1.3.0 L2 and 1.4.1 L2 mastercopies are supported
6969
- Only works with official Safe bytecode (no modified versions)
7070
- The mastercopy must be deployed and accessible on the network
7171
- Performance: The first initialization with a custom mastercopy will require additional RPC calls to fetch and compare bytecode
@@ -122,7 +122,7 @@ const safe = await Safe.init({
122122
// 3. If that fails:
123123
// - Read mastercopy address from storage (gets 0xabc...)
124124
// - Fetch bytecode from 0xabc...
125-
// - Compare with supported Safe L2 versions (1.1.1 L2 and 1.3.0 L2)
125+
// - Compare with supported Safe L2 versions (1.3.0 L2 and 1.4.1 L2)
126126
// - Find it matches v1.3.0 L2
127127
// - Initialize using v1.3.0 ABI
128128

packages/protocol-kit/src/utils/mastercopyMatcher.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export async function getMasterCopyAddressFromProxy(
2727

2828
/**
2929
* Attempts to match a contract's bytecode hash against supported Safe L2 singleton versions.
30-
* Only supports 1.1.1 L2 and 1.3.0 L2 mastercopies.
30+
* Only supports 1.3.0 L2 and 1.4.1 L2 mastercopies.
3131
*
3232
* @param safeProvider - The SafeProvider instance
3333
* @param contractAddress - The address of the contract to check
@@ -49,8 +49,8 @@ export async function matchContractCodeToSafeVersion(
4949
// Compute the keccak256 hash of the bytecode
5050
const contractCodeHash = keccak256(contractCode as `0x${string}`)
5151

52-
// Only check 1.1.1 L2 and 1.3.0 L2 versions
53-
const versionsToCheck: SafeVersion[] = ['1.3.0', '1.1.1']
52+
// Only check 1.3.0 L2 and 1.4.1 L2 versions
53+
const versionsToCheck: SafeVersion[] = ['1.4.1', '1.3.0']
5454

5555
// Try to match against each version - L2 only
5656
for (const version of versionsToCheck) {
@@ -87,7 +87,7 @@ export async function matchContractCodeToSafeVersion(
8787
/**
8888
* Attempts to determine the Safe version by matching the mastercopy code.
8989
* This is used as a fallback when the Safe address is not in the safe-deployments package.
90-
* Only supports 1.1.1 L2 and 1.3.0 L2 mastercopies.
90+
* Only supports 1.3.0 L2 and 1.4.1 L2 mastercopies.
9191
*
9292
* @param safeProvider - The SafeProvider instance
9393
* @param safeAddress - The address of the Safe proxy

packages/protocol-kit/tests/unit/mastercopy-matcher.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('Mastercopy Matcher', () => {
7171
it('should match contract code against supported Safe L2 versions', async () => {
7272
// This test would require actual contract bytecode from safe-deployments
7373
// For now, we test that it correctly computes the hash and tries to match
74-
// Only 1.1.1 L2 and 1.3.0 L2 are supported
74+
// Only 1.3.0 L2 and 1.4.1 L2 are supported
7575
const mockCode = '0x1234567890abcdef'
7676
;(safeProvider.getContractCode as sinon.SinonStub).resolves(mockCode)
7777

@@ -101,7 +101,7 @@ describe('Mastercopy Matcher', () => {
101101

102102
const result = await detectSafeVersionFromMastercopy(safeProvider, '0xSafeAddress', 1n)
103103

104-
// Since we're using mock code that won't match any real Safe L2 (1.1.1 or 1.3.0), expect undefined
104+
// Since we're using mock code that won't match any real Safe L2 (1.3.0 or 1.4.1), expect undefined
105105
chai.expect(result).to.be.undefined
106106
})
107107

@@ -113,7 +113,7 @@ describe('Mastercopy Matcher', () => {
113113

114114
;(safeProvider.getStorageAt as sinon.SinonStub).resolves(storageValue)
115115

116-
// If a match were found for 1.1.1 L2 or 1.3.0 L2, it would return an object with version, mastercopyAddress, and isL1=false
116+
// If a match were found for 1.3.0 L2 or 1.4.1 L2, it would return an object with version, mastercopyAddress, and isL1=false
117117
// For this test with mock data, it will return undefined
118118
const result = await detectSafeVersionFromMastercopy(safeProvider, '0xSafeAddress', 1n)
119119

0 commit comments

Comments
 (0)