From bda49ab31cf0fd874358bb2c33ea620b50a1e356 Mon Sep 17 00:00:00 2001 From: Lawrence Forman Date: Sat, 18 Nov 2023 23:19:01 -0500 Subject: [PATCH] update root readme. update bitmap nonces readme --- README.md | 4 +++- patterns/bitmap-nonces/README.md | 10 ++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8f4ac87..4765a95 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ This repo is an ongoing collection of useful, and occasionally clever, solidity/ - Contracts with upgradeable logic. - [Big Data Storage (SSTORE2)](./patterns/big-data-storage) - Cost efficient on-chain storage of multi-word data accessible to contracts. +- [Bitmap Nonces](./patterns/bitmap-nonces/) + - Efficiently tracking the state of many operations identifiable by a unique nonce. - [Commit + Reveal](./patterns/commit-reveal) - A two-step process for performing partially obscured on-chain actions that can't be front or back runned. - [EIP712 Signed Messages](./patterns/eip712-signed-messages) @@ -52,7 +54,7 @@ This repo is an ongoing collection of useful, and occasionally clever, solidity/ - [Read-Only Delegatecall](./patterns/readonly-delegatecall) - Execute arbitrary delegatecalls in your contract in a read-only manner, without side-effects. - [Reentrancy](./patterns/reentrancy) - - Explaining reentrancy vulnerabilities and patterns for addressing them. + - Explaining reentrancy vulnerabilities and patterns for addressing them (Checks-Effects-Interactions and reentrancy guards). - [Separate Allowance Targets](./patterns/separate-allowance-targets/) - Avoid having to migrate user allowances between upgrades with a dedicated approval contract. - [Stack-Too-Deep Workarounds](./patterns/stack-too-deep/) diff --git a/patterns/bitmap-nonces/README.md b/patterns/bitmap-nonces/README.md index 7584ceb..db18150 100644 --- a/patterns/bitmap-nonces/README.md +++ b/patterns/bitmap-nonces/README.md @@ -101,10 +101,8 @@ contract TransferRelay { } ``` -## In the Wild +## Final Thoughts -You can find bitmap nonces being used in major protocols such as Uniswap's [Permit2](https://github.com/Uniswap/permit2/blob/cc56ad0f3439c502c246fc5cfcc3db92bb8b7219/src/SignatureTransfer.sol#L142) and 0x's [Exchange Proxy](https://github.com/0xProject/protocol/blob/e66307ba319e8c3e2a456767403298b576abc85e/contracts/zero-ex/contracts/src/features/nft_orders/ERC721OrdersFeature.sol#L662). - -## The Demo - -The full, working example can be found [here](./TransferRelay.sol) with complete tests demonstrating its usage and gas savings [here](../../test/TransferRelay.sol). \ No newline at end of file +- You can find bitmap nonces being used in major protocols such as Uniswap's [Permit2](https://github.com/Uniswap/permit2/blob/cc56ad0f3439c502c246fc5cfcc3db92bb8b7219/src/SignatureTransfer.sol#L142) and 0x's [Exchange Proxy](https://github.com/0xProject/protocol/blob/e66307ba319e8c3e2a456767403298b576abc85e/contracts/zero-ex/contracts/src/features/nft_orders/ERC721OrdersFeature.sol#L662). +- There is no reason you couldn't track operations that have more than 2 states using bitmap nonces. You would just simply increase the number of bits in a word assigned to each operation and adjust the mapping formula accordingly. +- The full, working example can be found [here](./TransferRelay.sol) with complete tests demonstrating its usage and gas savings [here](../../test/TransferRelay.sol). \ No newline at end of file