Skip to content
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

Create generic function to DRY up parsing log output data #24

Open
seanmcgary opened this issue Sep 10, 2024 · 0 comments
Open

Create generic function to DRY up parsing log output data #24

seanmcgary opened this issue Sep 10, 2024 · 0 comments
Labels
chore enhancement New feature or request

Comments

@seanmcgary
Copy link
Collaborator

Currently we have a lot of functions that look like this and are very similar:

func parseLogOutputForPodSharesUpdatedEvent(outputDataStr string) (*podSharesUpdatedOutputData, error) {
	outputData := &podSharesUpdatedOutputData{}
	decoder := json.NewDecoder(strings.NewReader(outputDataStr))
	decoder.UseNumber()

	err := decoder.Decode(&outputData)
	if err != nil {
		return nil, err
	}
	return outputData, err
}

We should be able to refactor this into a generic function that takes the desired destination struct and decodes the JSON into it.

@seanmcgary seanmcgary added the enhancement New feature or request label Sep 10, 2024
@seanmcgary seanmcgary added this to the Testnet release candidate milestone Sep 12, 2024
seanmcgary added a commit that referenced this issue Oct 8, 2024
# This is the 1st commit message:

Calculate rewards

Add state change table for AVS operators to make windowing easier

Convert avs operator windows query to sqlite

Queries for snapshots

Testing OperatorAVSRegistrationWindows

Window query passing

Some cleanup

Expand test dataset to be more than just up to 2024-09-01

Restaked strategy snapshots

Test tweaks

Generate snapshots rather than windows

Add custom sum_big function

Adding tests for operator share snapshots

Change operatorShares to be a sparse table

Change StakerShares to a sparse table

Add snapshot generation for operator shares

Calculate rewards

remove git attributes

# This is the commit message #2:

Adding query stubs

# This is the commit message #3:

Adding more custom functions for math

# This is the commit message #4:

Copy over queries for gold table generation

# This is the commit message #5:

Use custom sql functions

# This is the commit message #6:

Use file-based db for testing rewards

# This is the commit message #7:

Staker amounts for nile and amazon forks

# This is the commit message #8:

Calculation testing

# This is the commit message #9:

Floating point math is the absolute worst

# This is the commit message #10:

Fix compliation

# This is the commit message #11:

More number tests

# This is the commit message #12:

Trying to get sqlite lib working

# This is the commit message #13:

This compiles and runs

# This is the commit message #14:

Also compiles

# This is the commit message #15:

Compiles and runs with added python stuff

# This is the commit message #16:

Delete compiled stuff

# This is the commit message #17:

Python seems to be working

# This is the commit message #18:

Working pre_nile_tokens_per_day

# This is the commit message #19:

Works with go example

# This is the commit message #20:

Port amazonStakerTokenRewards to native C

# This is the commit message #21:

Port nile_staker_token_rewards to native C

# This is the commit message #22:

Port amazon_operator_token_rewards and nile_operator_token_rewards to native C

# This is the commit message #23:

Rename yolo to calculations

# This is the commit message #24:

Add pure functions for easier testing

# This is the commit message #25:

Token calcuations test works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant