-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: mem store - fix flags, test expiration, & renamed to EIGENDA_PR…
…OXY env prefix
- Loading branch information
Showing
7 changed files
with
122 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
# Server listening address | ||
EIGEN_PLASMA_SERVER_ADDR=127.0.0.1 | ||
EIGENDA_PROXY_ADDR=127.0.0.1 | ||
|
||
# Server listening port (default: 3100) | ||
EIGEN_PLASMA_SERVER_PORT=3100 | ||
EIGENDA_PROXY_PORT=3100 | ||
|
||
# Directory path to SRS tables | ||
EIGEN_PLASMA_SERVER_EIGENDA_CACHE_PATH= | ||
EIGENDA_PROXY_EIGENDA_CACHE_PATH= | ||
|
||
# Directory path to g1.point file | ||
EIGEN_PLASMA_SERVER_EIGENDA_KZG_G1_PATH= | ||
EIGENDA_PROXY_EIGENDA_KZG_G1_PATH= | ||
|
||
# Directory path to g2.point.powerOf2 file | ||
EIGEN_PLASMA_SERVER_EIGENDA_G2_TAU_PATH= | ||
EIGENDA_PROXY_EIGENDA_G2_TAU_PATH= | ||
|
||
# RPC endpoint of the EigenDA disperser | ||
EIGEN_PLASMA_SERVER_EIGENDA_RPC= | ||
EIGENDA_PROXY_EIGENDA_RPC= | ||
|
||
# Wait time between retries of EigenDA blob status queries (default: 5s) | ||
EIGEN_PLASMA_SERVER_EIGENDA_STATUS_QUERY_INTERVAL=5s | ||
EIGENDA_PROXY_EIGENDA_STATUS_QUERY_INTERVAL=5s | ||
|
||
# Timeout for aborting an EigenDA blob dispersal (default: 25m0s) | ||
EIGEN_PLASMA_SERVER_EIGENDA_STATUS_QUERY_TIMEOUT=25m0s | ||
EIGENDA_PROXY_EIGENDA_STATUS_QUERY_TIMEOUT=25m0s | ||
|
||
# Use TLS when connecting to the EigenDA disperser (default: true) | ||
EIGEN_PLASMA_SERVER_EIGENDA_GRPC_USE_TLS=true | ||
EIGENDA_PROXY_EIGENDA_GRPC_USE_TLS=true | ||
|
||
# Color the log output if in terminal mode (default: false) | ||
EIGEN_PLASMA_SERVER_LOG_COLOR=false | ||
EIGENDA_PROXY_LOG_COLOR=false | ||
|
||
# Format the log output (default: text) | ||
# Supported formats: 'text', 'terminal', 'logfmt', 'json', 'json-pretty' | ||
EIGEN_PLASMA_SERVER_LOG_FORMAT=text | ||
EIGENDA_PROXY_LOG_FORMAT=text | ||
|
||
# The lowest log level that will be output (default: INFO) | ||
EIGEN_PLASMA_SERVER_LOG_LEVEL=INFO | ||
EIGENDA_PROXY_LOG_LEVEL=INFO | ||
|
||
# Metrics listening address (default: 0.0.0.0) | ||
EIGEN_PLASMA_SERVER_METRICS_ADDR=0.0.0.0 | ||
EIGENDA_PROXY_METRICS_ADDR=0.0.0.0 | ||
|
||
# Enable the metrics server (default: false) | ||
EIGEN_PLASMA_SERVER_METRICS_ENABLED=false | ||
EIGENDA_PROXY_METRICS_ENABLED=false | ||
|
||
# Metrics listening port (default: 7300) | ||
EIGEN_PLASMA_SERVER_METRICS_PORT=7300 | ||
EIGENDA_PROXY_METRICS_PORT=7300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package store | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
const ( | ||
testPreimage = "Four score and seven years ago" | ||
) | ||
|
||
func TestGetSet(t *testing.T) { | ||
ctx, cancel := context.WithCancel(context.Background()) | ||
defer cancel() | ||
|
||
ms, err := NewMemStore( | ||
ctx, | ||
&MemStoreConfig{ | ||
Enabled: true, | ||
BlobExpiration: time.Hour * 1000, | ||
}, | ||
) | ||
|
||
assert.NoError(t, err) | ||
|
||
expected := []byte(testPreimage) | ||
key, err := ms.Put(ctx, expected) | ||
assert.NoError(t, err) | ||
|
||
actual, err := ms.Get(ctx, key) | ||
assert.NoError(t, err) | ||
|
||
assert.Equal(t, actual, expected) | ||
} | ||
|
||
func TestExpiration(t *testing.T) { | ||
ctx, cancel := context.WithCancel(context.Background()) | ||
defer cancel() | ||
|
||
ms, err := NewMemStore( | ||
ctx, | ||
&MemStoreConfig{ | ||
Enabled: true, | ||
BlobExpiration: time.Millisecond * 10, | ||
}, | ||
) | ||
|
||
assert.NoError(t, err) | ||
|
||
preimage := []byte(testPreimage) | ||
key, err := ms.Put(ctx, preimage) | ||
assert.NoError(t, err) | ||
|
||
// sleep 1ms and verify that older entries are removed | ||
time.Sleep(time.Second * 1) | ||
|
||
_, err = ms.Get(ctx, key) | ||
assert.Error(t, err) | ||
|
||
} |