-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Integrate WeaveVM as a secondary backend in EigenDA proxy #198
base: main
Are you sure you want to change the base?
Changes from 2 commits
9343f0b
fc8a5eb
153107c
c4c7acb
3ee927c
605a3c7
f155de2
b42d34c
a6a304b
f730fdf
815a00a
c725446
15b5b3d
ac70008
4813df6
079da61
de49931
5644414
bee623c
1bb6c45
0c61e3f
5c5d826
1951f66
58cd1f6
2e80c95
a04dc93
4a14010
a30a578
3fc0019
8b2cb87
831a9cf
1b0164d
a640517
d600261
5a55327
5517256
36250aa
c1ba3ca
35eca7d
2e811ba
b3ccf6b
34fb623
2d77572
5d695bd
f10fea7
09df602
e4a41e5
434f78b
139dd4d
f5bfefa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package e2e_test | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
"time" | ||
|
||
|
@@ -37,7 +38,6 @@ this test asserts that the data can be posted/read to EigenDA | |
with a concurrent S3 backend configured | ||
*/ | ||
func TestOptimismClientWithGenericCommitment(t *testing.T) { | ||
|
||
if !runIntegrationTests && !runTestnetIntegrationTests { | ||
t.Skip("Skipping test as INTEGRATION or TESTNET env var not set") | ||
} | ||
|
@@ -124,11 +124,10 @@ func TestProxyCachingWithRedis(t *testing.T) { | |
} | ||
|
||
/* | ||
Ensure that fallback location is read from when EigenDA blob is not available. | ||
This is done by setting the memstore expiration time to 1ms and waiting for the blob to expire | ||
before attempting to read it. | ||
Ensure that fallback location is read from when EigenDA blob is not available. | ||
This is done by setting the memstore expiration time to 1ms and waiting for the blob to expire | ||
before attempting to read it. | ||
*/ | ||
|
||
func TestProxyReadFallback(t *testing.T) { | ||
// test can't be ran against holesky since read failure case can't be manually triggered | ||
if !runIntegrationTests || runTestnetIntegrationTests { | ||
|
@@ -166,3 +165,50 @@ func TestProxyReadFallback(t *testing.T) { | |
requireWriteReadSecondary(t, ts.Metrics.SecondaryRequestsTotal, common.S3BackendType) | ||
requireDispersalRetrievalEigenDA(t, ts.Metrics.HTTPServerRequestsTotal, commitments.SimpleCommitmentMode) | ||
} | ||
|
||
/* | ||
Tests fallback when wvm secondary backend is used. | ||
Works only when WVM_PRIV_KEY is set | ||
*/ | ||
func TestProxyReadFallbackOnWvm(t *testing.T) { | ||
privateKey := os.Getenv("WVM_PRIV_KEY") | ||
if privateKey == "" { | ||
t.Skip("Skipping test as WVM_PRIV_KEY has not been set") | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how is this private key channeled to the server config? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep..I didn't supply it through cli package There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
// test can't be ran against holesky since read failure case can't be manually triggered | ||
if !runIntegrationTests || runTestnetIntegrationTests { | ||
t.Skip("Skipping test as INTEGRATION env var not set") | ||
} | ||
|
||
t.Parallel() | ||
|
||
// setup server with S3 as a fallback option | ||
testCfg := e2e.TestConfig(useMemory()) | ||
testCfg.UseWVMFallback = true | ||
// ensure that blob memstore eviction times result in near immediate activation | ||
testCfg.Expiration = time.Millisecond * 1 | ||
|
||
tsConfig := e2e.TestSuiteConfig(testCfg) | ||
ts, kill := e2e.CreateTestSuite(tsConfig) | ||
defer kill() | ||
|
||
cfg := &client.Config{ | ||
URL: ts.Address(), | ||
} | ||
daClient := client.New(cfg) | ||
expectedBlob := e2e.RandBytes(1_000_000) | ||
t.Log("Setting input data on proxy server...") | ||
blobInfo, err := daClient.SetData(ts.Ctx, expectedBlob) | ||
require.NoError(t, err) | ||
|
||
time.Sleep(1 * time.Second) | ||
t.Log("Getting input data from proxy server...") | ||
actualBlob, err := daClient.GetData(ts.Ctx, blobInfo) | ||
require.NoError(t, err) | ||
require.Equal(t, expectedBlob, actualBlob) | ||
|
||
requireSimpleClientSetGet(t, ts, e2e.RandBytes(1_000_000)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. iiuc you're doing the same assertion logic twice There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm |
||
requireWriteReadSecondary(t, ts.Metrics.SecondaryRequestsTotal, common.WVMBackendType) | ||
requireDispersalRetrievalEigenDA(t, ts.Metrics.HTTPServerRequestsTotal, commitments.SimpleCommitmentMode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ import ( | |
"github.com/Layr-Labs/eigenda-proxy/store/generated_key/memstore" | ||
"github.com/Layr-Labs/eigenda-proxy/store/precomputed_key/redis" | ||
"github.com/Layr-Labs/eigenda-proxy/store/precomputed_key/s3" | ||
"github.com/Layr-Labs/eigenda-proxy/store/precomputed_key/wvm" | ||
"github.com/Layr-Labs/eigenda-proxy/verify" | ||
"github.com/urfave/cli/v2" | ||
|
||
|
@@ -24,6 +25,7 @@ const ( | |
S3Category = "S3 Cache/Fallback" | ||
VerifierCategory = "KZG and Cert Verifier" | ||
VerifierDeprecatedCategory = "DEPRECATED VERIFIER FLAGS -- THESE WILL BE REMOVED IN V2.0.0" | ||
WVMCategory = "WVM Fallback/Perm Storage option" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we explicitly prefix "weave"? most users won't know the term There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
) | ||
|
||
const ( | ||
|
@@ -73,4 +75,5 @@ func init() { | |
Flags = append(Flags, memstore.CLIFlags(EnvVarPrefix, MemstoreFlagsCategory)...) | ||
Flags = append(Flags, verify.CLIFlags(EnvVarPrefix, VerifierCategory)...) | ||
Flags = append(Flags, verify.DeprecatedCLIFlags(EnvVarPrefix, VerifierDeprecatedCategory)...) | ||
Flags = append(Flags, wvm.CLIFlags(EnvVarPrefix, WVMCategory)...) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,6 +210,7 @@ require ( | |
github.com/opencontainers/image-spec v1.1.0 // indirect | ||
github.com/opencontainers/runtime-spec v1.2.0 // indirect | ||
github.com/opentracing/opentracing-go v1.2.0 // indirect | ||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice only one new dependency |
||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect | ||
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 // indirect | ||
github.com/pingcap/errors v0.11.4 // indirect | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import ( | |
"github.com/Layr-Labs/eigenda-proxy/store/generated_key/memstore" | ||
"github.com/Layr-Labs/eigenda-proxy/store/precomputed_key/redis" | ||
"github.com/Layr-Labs/eigenda-proxy/store/precomputed_key/s3" | ||
"github.com/Layr-Labs/eigenda-proxy/store/precomputed_key/wvm" | ||
"github.com/Layr-Labs/eigenda-proxy/verify" | ||
"github.com/Layr-Labs/eigenda/api/clients" | ||
"github.com/ethereum/go-ethereum/log" | ||
|
@@ -19,7 +20,7 @@ import ( | |
// TODO - create structured abstraction for dependency injection vs. overloading stateless functions | ||
|
||
// populateTargets ... creates a list of storage backends based on the provided target strings | ||
func populateTargets(targets []string, s3 common.PrecomputedKeyStore, redis *redis.Store) []common.PrecomputedKeyStore { | ||
func populateTargets(targets []string, s3 common.PrecomputedKeyStore, redis *redis.Store, wvm common.PrecomputedKeyStore) []common.PrecomputedKeyStore { | ||
stores := make([]common.PrecomputedKeyStore, len(targets)) | ||
|
||
for i, f := range targets { | ||
|
@@ -38,6 +39,12 @@ func populateTargets(targets []string, s3 common.PrecomputedKeyStore, redis *red | |
} | ||
stores[i] = s3 | ||
|
||
case common.WVMBackendType: | ||
if wvm == nil { | ||
panic(fmt.Sprintf("WVM backend is not configured but specified in targets: %s", f)) | ||
} | ||
stores[i] = wvm | ||
|
||
case common.EigenDABackendType, common.MemoryBackendType: | ||
panic(fmt.Sprintf("Invalid target for fallback: %s", f)) | ||
|
||
|
@@ -58,6 +65,7 @@ func LoadStoreManager(ctx context.Context, cfg CLIConfig, log log.Logger, m metr | |
var err error | ||
var s3Store *s3.Store | ||
var redisStore *redis.Store | ||
var wvmStore *wvm.Store | ||
|
||
if cfg.EigenDAConfig.StorageConfig.S3Config.Bucket != "" && cfg.EigenDAConfig.StorageConfig.S3Config.Endpoint != "" { | ||
log.Info("Using S3 backend") | ||
|
@@ -67,6 +75,16 @@ func LoadStoreManager(ctx context.Context, cfg CLIConfig, log log.Logger, m metr | |
} | ||
} | ||
|
||
if cfg.EigenDAConfig.StorageConfig.WVMConfig.Enabled { | ||
if cfg.EigenDAConfig.StorageConfig.WVMConfig.Endpoint != "" { | ||
log.Info("Using WVM backend") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are there any invariants that we need to enforce on parameter ordering to identify misconfiguration at app initialization? if so please put them here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add checks on privatekey/signers and endpoint/chainid |
||
wvmStore, err = wvm.NewStore(&cfg.EigenDAConfig.StorageConfig.WVMConfig, log) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create WVM store: %w", err) | ||
} | ||
} | ||
} | ||
|
||
if cfg.EigenDAConfig.StorageConfig.RedisConfig.Endpoint != "" { | ||
log.Info("Using Redis backend") | ||
// create Redis backend store | ||
|
@@ -122,8 +140,8 @@ func LoadStoreManager(ctx context.Context, cfg CLIConfig, log log.Logger, m metr | |
} | ||
|
||
// create secondary storage router | ||
fallbacks := populateTargets(cfg.EigenDAConfig.StorageConfig.FallbackTargets, s3Store, redisStore) | ||
caches := populateTargets(cfg.EigenDAConfig.StorageConfig.CacheTargets, s3Store, redisStore) | ||
fallbacks := populateTargets(cfg.EigenDAConfig.StorageConfig.FallbackTargets, s3Store, redisStore, wvmStore) | ||
caches := populateTargets(cfg.EigenDAConfig.StorageConfig.CacheTargets, s3Store, redisStore, wvmStore) | ||
secondary := store.NewSecondaryManager(log, m, caches, fallbacks) | ||
|
||
if secondary.Enabled() { // only spin-up go routines if secondary storage is enabled | ||
|
@@ -135,6 +153,6 @@ func LoadStoreManager(ctx context.Context, cfg CLIConfig, log log.Logger, m metr | |
} | ||
} | ||
|
||
log.Info("Creating storage router", "eigenda backend type", eigenDA != nil, "s3 backend type", s3Store != nil) | ||
log.Info("Creating storage router", "eigenda backend type", eigenDA != nil, "s3 backend type", s3Store != nil, "wvm backend type", wvmStore != nil) | ||
return store.NewManager(eigenDA, s3Store, log, secondary) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please update the table to also reflect the WeaveVM cfg params?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done