Skip to content

Commit 664c2a5

Browse files
author
Christopher Scott
committed
replace ERC1271 with ERC1654
1 parent 2e1f0cc commit 664c2a5

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

contracts/ERC1271/ERC1271.sol renamed to contracts/ERC1654/ERC1654.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
pragma solidity ^0.5.6;
22

3-
contract ERC1271 {
3+
contract ERC1654 {
44

55
/// @dev bytes4(keccak256("isValidSignature(bytes32,bytes)")
6-
bytes4 internal constant ERC1271_VALIDSIGNATURE = 0x1626ba7e;
6+
bytes4 internal constant ERC1654_VALIDSIGNATURE = 0x1626ba7e;
77

88
/// @dev Should return whether the signature provided is valid for the provided data
99
/// @param hash 32-byte hash of the data that is signed

contracts/Test/Selector.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ contract Selector {
4242
return w.invoke2.selector;
4343
}
4444

45-
// ERC1271
45+
// ERC1654
4646
function isValidSignatureSelector() public pure returns (bytes4) {
4747
FullWallet w;
4848
return w.isValidSignature.selector;

contracts/Wallet/CoreWallet.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pragma solidity ^0.5.6;
22

33
import "../ERC721/ERC721Receivable.sol";
44
import "../ERC223/ERC223Receiver.sol";
5-
import "../ERC1271/ERC1271.sol";
5+
import "../ERC1654/ERC1654.sol";
66
import "../ECDSA.sol";
77

88

@@ -20,7 +20,7 @@ import "../ECDSA.sol";
2020
/// implemented here) is negligible even if you don't need the cosigner functionality, and
2121
/// (B) two-of-two multisig (as implemented here) handles a lot of really common use cases, most
2222
/// notably third-party gas payment and off-chain blacklisting and fraud detection.
23-
contract CoreWallet is ERC721Receivable, ERC223Receiver, ERC1271 {
23+
contract CoreWallet is ERC721Receivable, ERC223Receiver, ERC1654 {
2424

2525
using ECDSA for bytes;
2626

@@ -276,7 +276,7 @@ contract CoreWallet is ERC721Receivable, ERC223Receiver, ERC1271 {
276276
}
277277

278278
/// @notice Should return whether the signature provided is valid for the provided data
279-
/// See https://github.com/ethereum/EIPs/issues/1271
279+
/// See https://github.com/ethereum/EIPs/issues/1654
280280
/// @dev This function meets the following conditions as per the EIP:
281281
/// MUST return the bytes4 magic value `0x1626ba7e` when function passes.
282282
/// MUST NOT modify state (using `STATICCALL` for solc < 0.5, `view` modifier for solc > 0.5)
@@ -335,7 +335,7 @@ contract CoreWallet is ERC721Receivable, ERC223Receiver, ERC1271 {
335335
return 0;
336336
}
337337

338-
return ERC1271_VALIDSIGNATURE;
338+
return ERC1654_VALIDSIGNATURE;
339339
}
340340

341341
/// @notice Query if a contract implements an interface
@@ -351,7 +351,7 @@ contract CoreWallet is ERC721Receivable, ERC223Receiver, ERC1271 {
351351
interfaceID == ERC721_RECEIVED_FINAL || // ERC721 Final
352352
interfaceID == ERC721_RECEIVED_DRAFT || // ERC721 Draft
353353
interfaceID == ERC223_ID || // ERC223
354-
interfaceID == ERC1271_VALIDSIGNATURE; // ERC1271
354+
interfaceID == ERC1654_VALIDSIGNATURE; // ERC1654
355355
}
356356

357357
/// @notice A version of `invoke()` that has no explicit signatures, and uses msg.sender

test/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const funcHash = signature => {
7979
* @param {string} walletAddr address of wallet
8080
* @param {Buffer} hash hashed data
8181
*/
82-
const getSha3ForERC1271 = (walletAddr, hash) => {
82+
const getSha3ForERC1654 = (walletAddr, hash) => {
8383
return abi.soliditySHA3(
8484
['int8', 'int8', 'address', 'bytes32'],
8585
[0x19, 0x0, new BN(walletAddr.replace('0x', ''), 16), hash]
@@ -199,7 +199,7 @@ module.exports = {
199199
waitForEvents,
200200
expectThrow,
201201
getSha3ForConfirmationTx,
202-
getSha3ForERC1271,
202+
getSha3ForERC1654,
203203
//getSha3ForConfirmationTxCallData,
204204
serializeSignature,
205205
serializeSignatures,

test/wallet.test.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,14 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
215215
}
216216
});
217217

218-
describe('concerning ERC1271 compatibility', function () {
218+
describe('concerning ERC1654 compatibility', function () {
219219
const data = "hello world";
220-
const ERC1271_VS = "0x1626ba7e";
220+
const ERC1654_VS = "0x1626ba7e";
221221

222222
it('should be able to validate a signature', async function () {
223223
// prepare a signature from the signer and the cosigner
224224
const dataHash = abi.soliditySHA3(['string'], [data]);
225-
const hashToSign = utils.getSha3ForERC1271(
225+
const hashToSign = utils.getSha3ForERC1654(
226226
wallet.address,
227227
dataHash
228228
);
@@ -234,12 +234,12 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
234234
// call contract
235235
const result = await wallet.isValidSignature('0x' + dataHash.toString('hex'), combined);
236236
// check result
237-
result.should.eql(ERC1271_VS);
237+
result.should.eql(ERC1654_VS);
238238
});
239239

240240
it('should return 0 if provided an invalid signature', async function () {
241241
const dataHash = abi.soliditySHA3(['string'], [data]);
242-
const hashToSign = utils.getSha3ForERC1271(
242+
const hashToSign = utils.getSha3ForERC1654(
243243
wallet.address,
244244
dataHash
245245
);
@@ -257,7 +257,7 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
257257
it('should return 0 if provided an invalid signature length', async function () {
258258

259259
const dataHash = abi.soliditySHA3(['string'], [data]);
260-
const hashToSign = utils.getSha3ForERC1271(
260+
const hashToSign = utils.getSha3ForERC1654(
261261
wallet.address,
262262
dataHash
263263
);
@@ -273,7 +273,7 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
273273

274274
it('should return 0 if only given 1 signature', async function () {
275275
const dataHash = abi.soliditySHA3(['string'], [data]);
276-
const hashToSign = utils.getSha3ForERC1271(
276+
const hashToSign = utils.getSha3ForERC1654(
277277
wallet.address,
278278
dataHash
279279
);
@@ -287,7 +287,7 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
287287
it('should return 0 if given signature from a key that is not the cosigner', async function () {
288288

289289
const dataHash = abi.soliditySHA3(['string'], [data]);
290-
const hashToSign = utils.getSha3ForERC1271(
290+
const hashToSign = utils.getSha3ForERC1654(
291291
wallet.address,
292292
dataHash
293293
);
@@ -304,7 +304,7 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
304304
it('should return 0 if given signature from a key that is not an authorized key', async function () {
305305

306306
const dataHash = abi.soliditySHA3(['string'], [data]);
307-
const hashToSign = utils.getSha3ForERC1271(
307+
const hashToSign = utils.getSha3ForERC1654(
308308
wallet.address,
309309
dataHash
310310
);
@@ -3561,14 +3561,14 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
35613561
}
35623562
});
35633563

3564-
describe('concerning ERC1271 compatibility', function () {
3564+
describe('concerning ERC1654 compatibility', function () {
35653565
const data = "hello worlds";
3566-
const ERC1271_VS = "0x1626ba7e";
3566+
const ERC1654_VS = "0x1626ba7e";
35673567

35683568
it('should be able to validate a signature', async function () {
35693569
// prepare a signature from the signer and the cosigner
35703570
const dataHash = abi.soliditySHA3(['string'], [data]);
3571-
const hashToSign = utils.getSha3ForERC1271(
3571+
const hashToSign = utils.getSha3ForERC1654(
35723572
wallet.address,
35733573
dataHash
35743574
);
@@ -3578,13 +3578,13 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
35783578
// call contract
35793579
const result = await wallet.isValidSignature('0x' + dataHash.toString('hex'), combined);
35803580
// check result
3581-
result.should.eql(ERC1271_VS);
3581+
result.should.eql(ERC1654_VS);
35823582
});
35833583

35843584
it('should be able to validate a signature with two signatures', async function () {
35853585
// prepare a signature from the signer and the cosigner
35863586
const dataHash = abi.soliditySHA3(['string'], [data]);
3587-
const hashToSign = utils.getSha3ForERC1271(
3587+
const hashToSign = utils.getSha3ForERC1654(
35883588
wallet.address,
35893589
dataHash
35903590
);
@@ -3596,12 +3596,12 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
35963596
// call contract
35973597
const result = await wallet.isValidSignature('0x' + dataHash.toString('hex'), combined);
35983598
// check result
3599-
result.should.eql(ERC1271_VS);
3599+
result.should.eql(ERC1654_VS);
36003600
});
36013601

36023602
it('should return 0 if provided an invalid signature', async function () {
36033603
const dataHash = abi.soliditySHA3(['string'], [data]);
3604-
const hashToSign = utils.getSha3ForERC1271(
3604+
const hashToSign = utils.getSha3ForERC1654(
36053605
wallet.address,
36063606
dataHash
36073607
);
@@ -3615,7 +3615,7 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
36153615

36163616
it('should return 0 if provided an invalid signature length', async function () {
36173617
const dataHash = abi.soliditySHA3(['string'], [data]);
3618-
const hashToSign = utils.getSha3ForERC1271(
3618+
const hashToSign = utils.getSha3ForERC1654(
36193619
wallet.address,
36203620
dataHash
36213621
);
@@ -3630,7 +3630,7 @@ const testSuite = async function (wtype, accounts, _walletFactory, _cloneAddress
36303630

36313631
it('should return 0 if given signature from a key that is not an authorized key', async function () {
36323632
const dataHash = abi.soliditySHA3(['string'], [data]);
3633-
const hashToSign = utils.getSha3ForERC1271(
3633+
const hashToSign = utils.getSha3ForERC1654(
36343634
wallet.address,
36353635
dataHash
36363636
);
@@ -4851,8 +4851,8 @@ contract('Wallet', async (accounts) => {
48514851
const ERC721_RECEIVED_DRAFT = "0xf0b9e5ba";
48524852
const ERC223_ID = "0xc0ee0b8a";
48534853
const ERC165_ID = "0x01ffc9a7"
4854-
const ERC1271_VS = "0x1626ba7e";
4855-
addrs = [ERC721_RECEIVED_FINAL, ERC721_RECEIVED_DRAFT, ERC223_ID, ERC165_ID, ERC1271_VS];
4854+
const ERC1654_VS = "0x1626ba7e";
4855+
addrs = [ERC721_RECEIVED_FINAL, ERC721_RECEIVED_DRAFT, ERC223_ID, ERC165_ID, ERC1654_VS];
48564856
});
48574857

48584858
it('should return true for the interfaces it implements', async function () {

0 commit comments

Comments
 (0)