From 856a920fdf0a5f76020e7e112cc9645245cc4c0f Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 5 May 2021 17:39:15 -0400 Subject: [PATCH 1/2] fix[contracts]: Remove verifyExclusionProof --- .../libraries/trie/Lib_MerkleTrie.sol | 28 ------------------- .../libraries/trie/Lib_SecureMerkleTrie.sol | 25 ----------------- .../trie/TestLib_MerkleTrie.sol | 18 ------------ .../trie/TestLib_SecureMerkleTrie.sol | 18 ------------ 4 files changed, 89 deletions(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol index b1f8a8d19eb78..2997f704b7c54 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/trie/Lib_MerkleTrie.sol @@ -92,34 +92,6 @@ library Lib_MerkleTrie { ); } - /** - * @notice Verifies a proof that a given key is *not* present in - * the Merkle trie. - * @param _key Key of the node to search for, as a hex string. - * @param _proof Merkle trie inclusion proof for the node *nearest* the - * target node. - * @param _root Known root of the Merkle trie. Used to verify that the - * included proof is correctly constructed. - * @return _verified `true` if the key is absent in the trie, `false` otherwise. - */ - function verifyExclusionProof( - bytes memory _key, - bytes memory _proof, - bytes32 _root - ) - internal - pure - returns ( - bool _verified - ) - { - ( - bool exists, - ) = get(_key, _proof, _root); - - return exists == false; - } - /** * @notice Updates a Merkle trie and returns a new root hash. * @param _key Key of the node to update, as a hex string. diff --git a/packages/contracts/contracts/optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol b/packages/contracts/contracts/optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol index 80a6702540d6d..ba6aba7f09930 100644 --- a/packages/contracts/contracts/optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol +++ b/packages/contracts/contracts/optimistic-ethereum/libraries/trie/Lib_SecureMerkleTrie.sol @@ -42,31 +42,6 @@ library Lib_SecureMerkleTrie { return Lib_MerkleTrie.verifyInclusionProof(key, _value, _proof, _root); } - /** - * @notice Verifies a proof that a given key is *not* present in - * the Merkle trie. - * @param _key Key of the node to search for, as a hex string. - * @param _proof Merkle trie inclusion proof for the node *nearest* the - * target node. - * @param _root Known root of the Merkle trie. Used to verify that the - * included proof is correctly constructed. - * @return _verified `true` if the key is not present in the trie, `false` otherwise. - */ - function verifyExclusionProof( - bytes memory _key, - bytes memory _proof, - bytes32 _root - ) - internal - pure - returns ( - bool _verified - ) - { - bytes memory key = _getSecureKey(_key); - return Lib_MerkleTrie.verifyExclusionProof(key, _proof, _root); - } - /** * @notice Updates a Merkle trie and returns a new root hash. * @param _key Key of the node to update, as a hex string. diff --git a/packages/contracts/contracts/test-libraries/trie/TestLib_MerkleTrie.sol b/packages/contracts/contracts/test-libraries/trie/TestLib_MerkleTrie.sol index 36335db39f142..3775c0ba98854 100644 --- a/packages/contracts/contracts/test-libraries/trie/TestLib_MerkleTrie.sol +++ b/packages/contracts/contracts/test-libraries/trie/TestLib_MerkleTrie.sol @@ -29,24 +29,6 @@ contract TestLib_MerkleTrie { ); } - function verifyExclusionProof( - bytes memory _key, - bytes memory _proof, - bytes32 _root - ) - public - pure - returns ( - bool - ) - { - return Lib_MerkleTrie.verifyExclusionProof( - _key, - _proof, - _root - ); - } - function update( bytes memory _key, bytes memory _value, diff --git a/packages/contracts/contracts/test-libraries/trie/TestLib_SecureMerkleTrie.sol b/packages/contracts/contracts/test-libraries/trie/TestLib_SecureMerkleTrie.sol index 5ab749a426473..49bf74216a016 100644 --- a/packages/contracts/contracts/test-libraries/trie/TestLib_SecureMerkleTrie.sol +++ b/packages/contracts/contracts/test-libraries/trie/TestLib_SecureMerkleTrie.sol @@ -30,24 +30,6 @@ contract TestLib_SecureMerkleTrie { ); } - function verifyExclusionProof( - bytes memory _key, - bytes memory _proof, - bytes32 _root - ) - public - pure - returns ( - bool - ) - { - return Lib_SecureMerkleTrie.verifyExclusionProof( - _key, - _proof, - _root - ); - } - function update( bytes memory _key, bytes memory _value, From fcd8d9dae28ed140d80865d2defb63d5c26bd976 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 5 May 2021 17:55:31 -0400 Subject: [PATCH 2/2] chore: Add changeset --- .changeset/thin-horses-change.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/thin-horses-change.md diff --git a/.changeset/thin-horses-change.md b/.changeset/thin-horses-change.md new file mode 100644 index 0000000000000..70a323982f508 --- /dev/null +++ b/.changeset/thin-horses-change.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': patch +--- + +Removed verifyExclusionProof function from MerkleTrie library.