Skip to content

Commit

Permalink
Add function version for edge lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejearley committed Oct 30, 2023
1 parent effe06e commit 9361cdc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 25 deletions.
31 changes: 23 additions & 8 deletions apps/docs/src/introduction/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,29 @@ This page is incomplete.

# Architecture

The Casimir staking architecture consists of the following components:
Todo. Explain stakeholders and their entrypoints. Internal contracts, external contracts, operators, oracles, etc.

- An [Ethereum RPC Node](#ethereum-rpc-node) that connects the SSV DVT node to the Ethereum network.
- An [SSV Node](#ssv-node) that performs cluster duties for validators.
- An [SSV DKG server](#ssv-dkg-server) that participates in key generation and resharing ceremonies.
## Contracts

Casimir deploys the following contracts:

- A [Casimir factory](#casimir-factory) that configures and deploys staking strategies.
- For each staking strategy:
- A [Casimir manager](#casimir-manager) that is the entrypoint for stakers and deploys and distributes to validator pools.
- A [Casimir registry](#casimir-registry) that is the entrypoint for operators and binds collateral to validators pools.
- A [Casimir upkeep](#casimir-upkeep) that automates distributed consensus layer reports.
- A [Casimir views](#casimir-views) that provides a read-only interface to the strategy.
- For each validator pool:
- A [Casimir pool](#casimir-pool) that either serves as the withdrawal address for a validator or provides a proxy to the withdrawal address.
- A [Casimir oracle](#casimir-oracle) that executes operator selection, triggers DKG ceremonies, submits verifiable validator creation, resharing, and exit reports, and allocates reserved operational fees to operators.

As we add new strategies and features leading up to our mainnet release, the contracts will require upgrades. Accordingly, the Casimir factory is deployed as a transparent proxy, while the other contracts are deployed as beacon proxies.

```mermaid
%%{
init: {
'theme': 'base',
'themeVariables': {
'fontFamily': 'Inter',
'lineColor': '#E2E2E3',
'primaryColor': '#F6F6F7',
'primaryTextColor': '#3C3C43',
Expand Down Expand Up @@ -61,7 +72,11 @@ graph TB
end
```

<!-- The Casimir staking system consists of the following components:
### External Contracts

The Casimir contracts integrate with the following external contracts:

- The [Ethereum deposit contract](#ethereum-deposit-contract) that is the entrypoint for validator deposits to the consensus layer.
- The [SSV network](#ssv-network) that provides DVT validators with permissionless operators.
- Todo finish.

- A [factory contract](#factory-contract) that manages the creation of [staking strategies](#staking-strategies), each with a distinct [manager contract](#manager-contract), [registry contract](#registry-contract), [upkeep contract](#upkeep-contract), and [views contract](#views-contract).
- -->
12 changes: 1 addition & 11 deletions apps/docs/src/introduction/what-is-casimir.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,4 @@ This page is incomplete.

# What is Casimir?

## The Problem

## Casimir Staking

<!-- Currlently stakers either need to solo-stake (and have least 32 Ether), or they need to pool their assets in a liquid staking protocol (LSD). While the former choice is a reliably secure choice for Ether holders (if they have solid infrastructure), the latter, LSDs, often present an inherent counterparty risk to the user because of their centralized control of staking node operators (see [The Risks of LSD](https://notes.ethereum.org/@djrtwo/risks-of-lsd)).
Casimir is designed to offer users the experience and security of solo-staking while pooling their assets. The Casimir contracts seamlessly connect stakers with any amount of Ether to a permissionless registry of high-performing node operators. Casimir aims to minimize counterparty risk for users and improve decentralization in Ethereum staking:
- Validators duties are performed by registered (collateralized) operators running distributed validator technology (DVT)
- Keys are created and reshared using distributed key generation (DKG)
- Balance and status reports are reported by a decentralized oracle network (DON) -->
Casimir is a decentralized Ethereum staking platform that gives users intuitive access and control over their assets while their stake is attested by distributed validator technology (DVT). Casimir seamlessly connect stakers with any amount of Ether to a permissionless registry of high-performing node operators, who perform the duties of validators using shares created with distributed key generation (DKG). Stakers and operators can choose from multiple staking strategies, opening up a variety of new staking opportunities in addition to secure, simple staking.
14 changes: 8 additions & 6 deletions infrastructure/cdk/src/providers/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Config } from './config'
export class DocsStack extends cdk.Stack {
public readonly name = pascalCase('docs')
public readonly assetPath = '../../apps/docs/dist'
public readonly lambdaPath = '../../services/redirect/dist'
public readonly functionPath = '../../services/redirect/dist'

constructor(scope: Construct, id: string, props: DocsStackProps) {
super(scope, id, props)
Expand All @@ -45,18 +45,20 @@ export class DocsStack extends cdk.Stack {
})
})()

const redirectLambda = new cloudfront.experimental.EdgeFunction(this, config.getFullStackResourceName(this.name, 'redirect'), {
runtime: lambda.Runtime.NODEJS_18_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(this.functionPath)
})

const distribution = new cloudfront.Distribution(this, config.getFullStackResourceName(this.name, 'distribution'), {
certificate: distributionCertificate,
defaultRootObject: 'index.html',
defaultBehavior: {
edgeLambdas: [
{
eventType: cloudfront.LambdaEdgeEventType.VIEWER_REQUEST,
functionVersion: new cloudfront.experimental.EdgeFunction(this, config.getFullStackResourceName(this.name, 'redirect'), {
runtime: lambda.Runtime.NODEJS_18_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(this.lambdaPath)
})
functionVersion: redirectLambda.currentVersion
}
],
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
Expand Down

0 comments on commit 9361cdc

Please sign in to comment.