Skip to content

Commit

Permalink
added more functions
Browse files Browse the repository at this point in the history
  • Loading branch information
star-gazer111 committed Aug 18, 2024
1 parent e9c7de2 commit cd56489
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 95 deletions.
9 changes: 3 additions & 6 deletions common/types.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package common

type Block struct {

}
type Transactions struct{

type Transactions struct {
}

// can be an enum
type BlockTag struct {

}

// need some error structs and enums as well
// Example: BlockNotFoundError
// need some error structs and enums as well
// Example: BlockNotFoundError
4 changes: 2 additions & 2 deletions config/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package config
type BaseConfig struct{
}

// implement a default method for tthe above struct
func (b BaseConfig) def() BaseConfig{
// implement a default method for the above struct
func (b BaseConfig) default() BaseConfig{

}
70 changes: 32 additions & 38 deletions config/checkpoints/checkpoints.go
Original file line number Diff line number Diff line change
@@ -1,70 +1,64 @@
package checkpoints

//networks file will be used (import package config)
type StartEndTime struct{

// networks file will be used (import package config)
type StartEndTime struct {
}
type Health struct{

type Health struct {
}
type CheckpointFallbackService struct{

type CheckpointFallbackService struct {
}
type CheckpointFallback struct{

type CheckpointFallback struct {
}
type RawSlotResponse struct{

type RawSlotResponse struct {
}
type RawSlotResponseData struct{

type RawSlotResponseData struct {
}
type Slot struct{

type Slot struct {
}


func get() {}
func deserialize_slot() {}

// parameters and return types need not be correct currently

func (ch CheckpointFallback) new(){
func (ch CheckpointFallback) new() {

}

func (ch CheckpointFallback) build(){
func (ch CheckpointFallback) build() {

}

func (ch CheckpointFallback) fetch_latest_checkpoint(){
func (ch CheckpointFallback) fetch_latest_checkpoint() {

}

func (ch CheckpointFallback) query_service(){
func (ch CheckpointFallback) query_service() {

}

func (ch CheckpointFallback) fetch_latest_checkpoint_from_services(){
func (ch CheckpointFallback) fetch_latest_checkpoint_from_services() {

}

func (ch CheckpointFallback) fetch_latest_checkpoint_from_api(){
func (ch CheckpointFallback) fetch_latest_checkpoint_from_api() {

}

func (ch CheckpointFallback) construct_url(){
func (ch CheckpointFallback) construct_url() {

}

func (ch CheckpointFallback) get_all_fallback_endpoints(){
func (ch CheckpointFallback) get_all_fallback_endpoints() {

}

func (ch CheckpointFallback) get_healthy_fallback_endpoints(){

func (ch CheckpointFallback) get_healthy_fallback_endpoints() {

}
func (ch CheckpointFallback) get_healthy_fallback_services() {

}
func (ch CheckpointFallback) get_healthy_fallback_services(){
func (ch CheckpointFallback) get_fallback_services() {

}
func (ch CheckpointFallback) get_fallback_services(){

}
8 changes: 8 additions & 0 deletions config/cli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package config

type CliConfig struct {
}

func (ch CliConfig) as_provider() {

}
12 changes: 6 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package config

type Config struct{

type Config struct {
}

// only if we are using CLI
func(c Config) from_file() Config{
func (c Config) from_file() Config {

}
func (c Config) to_base_config()BaseConfig{
func (c Config) to_base_config() BaseConfig {

}
func (c Config) fork_version(slot uint64) []uint8{
func (c Config) fork_version(slot uint64) []uint8 {

}
}
16 changes: 8 additions & 8 deletions config/networks.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package config


type Network string

const (
MAINNET Network = "MAINNET"
GOERLI Network = "GOERLI"
SEPOLIA Network = "SEPOLIA"
MAINNET Network = "MAINNET"
GOERLI Network = "GOERLI"
SEPOLIA Network = "SEPOLIA"
)

// hardcode the base configurations for each of the networks
//check s and write switch case
func (n Network) base_config(s string)(BaseConfig,error){
// check s and write switch case
func (n Network) base_config(s string) (BaseConfig, error) {

}

func (n Network) chain_id(s string)(uint64,error){
func (n Network) chain_id(s string) (uint64, error) {

}
}
func data_dir() {}
27 changes: 13 additions & 14 deletions consensus/database.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
package consensus

// uses config mmodule
type Database interface{
new()
save_checkpoint()
load_checkpoint()
type Database interface {
new()
save_checkpoint()
load_checkpoint()
}

//NOTE: parameters are not included
type FileDB struct{Database}
// NOTE: parameters are not included
type FileDB struct{ Database }

func (f FileDB)new() FileDB{}
func (f FileDB)save_checkpoint() FileDB{}
func (f FileDB)load_checkpoint() FileDB{}
func (f FileDB) new() FileDB {}
func (f FileDB) save_checkpoint() FileDB {}
func (f FileDB) load_checkpoint() FileDB {}

type ConfigDB struct{ Database }


type ConfigDB struct{Database}
func (cdb ConfigDB)new() ConfigDB{}
func (cdb ConfigDB)save_checkpoint() ConfigDB{}
func (cdb ConfigDB)load_checkpoint() ConfigDB{}
func (cdb ConfigDB) new() ConfigDB {}
func (cdb ConfigDB) save_checkpoint() ConfigDB {}
func (cdb ConfigDB) load_checkpoint() ConfigDB {}
2 changes: 1 addition & 1 deletion consensus/rpc/mock_rpc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package rpc

//if we need to test the working we can by adding the whole code of nimbus_rpc here
// and add a path to some local testdata folder
// and add a path to some local testdata folder
20 changes: 10 additions & 10 deletions consensus/rpc/nimbus_rpc.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package rpc

// uses types package
type NimbusRpc struct{
type NimbusRpc struct {
ConsensusRpc
rpc string
}

func(n NimbusRpc) new(){}
func(n NimbusRpc) get_bootstrap(){}
func(n NimbusRpc) get_updates(){}
func(n NimbusRpc) get_finality_update(){}
func(n NimbusRpc) get_optimistic_update(){}
func(n NimbusRpc) get_block(){}
func(n NimbusRpc) chain_id(){}

func get() {}

func (n NimbusRpc) new() {}
func (n NimbusRpc) get_bootstrap() {}
func (n NimbusRpc) get_updates() {}
func (n NimbusRpc) get_finality_update() {}
func (n NimbusRpc) get_optimistic_update() {}
func (n NimbusRpc) get_block() {}
func (n NimbusRpc) chain_id() {}

type BeaconBlockResponse struct{}
type BeaconBlockData struct{}
type UpdateResponse = []UpdateData;
type UpdateResponse = []UpdateData
type UpdateData struct{}
type FinalityUpdateResponse struct{}
type OptimisticUpdateResponse struct{}
Expand Down
19 changes: 9 additions & 10 deletions consensus/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ package consensus

// uses types package


func calculate_sync_period(){}
func is_aggregate_valid(){}
func is_proof_valid(){}
func compute_signing_root(){}
func compute_domian(){}
func compute_fork_data_root(){}
func branch_to_nodes(){}
func bytes32_to_nodes(){}
func calculate_sync_period() {}
func is_aggregate_valid() {}
func is_proof_valid() {}
func compute_signing_root() {}
func compute_domian() {}
func compute_fork_data_root() {}
func branch_to_nodes() {}
func bytes32_to_nodes() {}

type SigningData struct{}
type ForkData struct{}
type ForkData struct{}

0 comments on commit cd56489

Please sign in to comment.