Skip to content

Commit b109f01

Browse files
authored
Merge pull request #2 from megaeth-labs/xiaohui/fix/fix_typo
typo: fix name typo
2 parents 5d709d9 + effbe6e commit b109f01

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A demonstration of a gas-efficient key-value store implementation using Red-Blac
44

55
## Overview
66

7-
This project implements a Red-Black Tree based key-value store (`RedBlockTreeKV`) that stores complex value structures efficiently. The implementation is particularly beneficial for use cases involving frequent insertions and deletions, as it reuses storage slots and minimizes gas consumption.
7+
This project implements a Red-Black Tree based key-value store (`RedBlackTreeKV`) that stores complex value structures efficiently. The implementation is particularly beneficial for use cases involving frequent insertions and deletions, as it reuses storage slots and minimizes gas consumption.
88

99
The Red-Black Tree implementation is based on [Solady's RedBlackTreeLib](https://github.com/vectorized/solady/blob/main/src/utils/RedBlackTreeLib.sol). In this example, we modified the `remove` function to prevent deleting storage when removing nodes, enabling storage slot reuse for subsequent insertions.
1010

@@ -38,15 +38,15 @@ The Red-Black Tree implementation shows **90% gas reduction** for hot insertions
3838

3939
```
4040
src/
41-
├── RedBlockTreeKV.sol # Main KV store implementation
41+
├── RedBlackTreeKV.sol # Main KV store implementation
4242
├── MappingKV.sol # Traditional mapping implementation for comparison
4343
└── lib/
4444
├── RedBlackTreeLib.sol # Red-Black Tree data structure library
4545
└── Value.sol # Value struct definition
4646
4747
test/
48-
├── RedBlockTreeKV.t.sol # Comprehensive unit tests
49-
└── RedBlockTreeKVGas.t.sol # Gas benchmark tests
48+
├── RedBlackTreeKV.t.sol # Comprehensive unit tests
49+
└── RedBlackTreeKVGas.t.sol # Gas benchmark tests
5050
```
5151

5252
## Value Structure
@@ -70,7 +70,7 @@ struct Value {
7070
### Basic Operations
7171

7272
```solidity
73-
RedBlockTreeKV kv = new RedBlockTreeKV();
73+
RedBlackTreeKV kv = new RedBlackTreeKV();
7474
7575
// Create a value
7676
ValueLib.Value memory value = ValueLib.Value({
@@ -116,7 +116,7 @@ forge build
116116
forge test
117117

118118
# Run unit tests only
119-
forge test --match-contract RedBlockTreeKVTest
119+
forge test --match-contract RedBlackTreeKVTest
120120

121121
# Run gas benchmarks
122122
forge test --match-contract MappingGasTest -vv

src/RedBlockTreeKV.sol renamed to src/RedBlackTreeKV.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {RedBlackTreeLib} from "./lib/RedBlackTreeLib.sol";
55
import {ValueLib} from "./lib/Value.sol";
66

77
// A simple RBT kv example. It is gas-efficient if frequently add & remove.
8-
contract RedBlockTreeKV {
8+
contract RedBlackTreeKV {
99
uint256 private constant _DATA_SLOT_SEED = 0xdeadbeef; // Arbitrary unique seed
1010
uint256 private constant _SLOTS_PER_POSITION = ValueLib.SLOTS_PER_POSITION; // Dense slots per value
1111

test/RedBlockTreeKV.t.sol renamed to test/RedBlackTreeKV.t.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
pragma solidity ^0.8.30;
33

44
import {Test, console} from "forge-std/Test.sol";
5-
import {RedBlockTreeKV} from "../src/RedBlockTreeKV.sol";
5+
import {RedBlackTreeKV} from "../src/RedBlackTreeKV.sol";
66
import {ValueLib} from "../src/lib/Value.sol";
77
import {RedBlackTreeLib} from "../src/lib/RedBlackTreeLib.sol";
88

9-
contract RedBlockTreeKVTest is Test {
10-
RedBlockTreeKV public redBlockTreeKV;
9+
contract RedBlackTreeKVTest is Test {
10+
RedBlackTreeKV public redBlockTreeKV;
1111

1212
function setUp() public {
13-
redBlockTreeKV = new RedBlockTreeKV();
13+
redBlockTreeKV = new RedBlackTreeKV();
1414
}
1515

1616
function generateValue(uint256 value) internal pure returns (ValueLib.Value memory) {

test/RedBlockTreeKVGas.t.sol renamed to test/RedBlackTreeKVGas.t.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
pragma solidity ^0.8.30;
33

44
import {Test, console} from "forge-std/Test.sol";
5-
import {RedBlockTreeKV} from "../src/RedBlockTreeKV.sol";
5+
import {RedBlackTreeKV} from "../src/RedBlackTreeKV.sol";
66
import {MappingKV} from "../src/MappingKV.sol";
77
import {ValueLib} from "../src/lib/Value.sol";
88

99
contract MappingGasTest is Test {
1010
uint256 private constant _INSERT_COUNT = 1000;
11-
RedBlockTreeKV public redBlockTreeKV;
11+
RedBlackTreeKV public redBlockTreeKV;
1212
MappingKV public mappingKV;
1313

1414
function setUp() public {
15-
redBlockTreeKV = new RedBlockTreeKV();
15+
redBlockTreeKV = new RedBlackTreeKV();
1616
mappingKV = new MappingKV();
1717
}
1818

0 commit comments

Comments
 (0)