Skip to content

Commit

Permalink
Update functions to use rust versions
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcgary committed Oct 16, 2024
1 parent 44e3726 commit e1b5582
Show file tree
Hide file tree
Showing 11 changed files with 576 additions and 1,560 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ go-sidecar
/internal/tests/testdata/*.sql
!/internal/tests/testdata/**/generateExpectedResults.sql
!/internal/tests/testdata/**/*generateExpectedResults.sql
!sqlite-extensions
sqlite-extensions
/*.tar
/sidecar-data
__pycache__
test-db
*.dylib
*.dylib.dSYM
/sqlite-extensions/build
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
PROJECT_ROOT = $(shell pwd)
CGO_CFLAGS = "-I$(PROJECT_ROOT)/sqlite-extensions"
CGO_LDFLAGS = "-L$(PROJECT_ROOT)/sqlite-extensions/build/lib -lcalculations -Wl,-rpath,$(PROJECT_ROOT)/sqlite-extensions/build/lib"
PYTHONPATH = $(PROJECT_ROOT)/sqlite-extensions
CGO_ENABLED = 1
GO=$(shell which go)
ALL_FLAGS=CGO_CFLAGS=$(CGO_CFLAGS) CGO_LDFLAGS=$(CGO_LDFLAGS) PYTHONPATH=$(PYTHONPATH) CGO_ENABLED=$(CGO_ENABLED)
ALL_FLAGS=CGO_CFLAGS=$(CGO_CFLAGS) CGO_LDFLAGS=$(CGO_LDFLAGS) CGO_ENABLED=$(CGO_ENABLED)

deps/dev:
${GO} install github.com/golangci/golangci-lint/cmd/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion cmd/debugger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ staker_weight_sum AS (
-- Calculate staker proportion of tokens for each reward and snapshot
staker_proportion AS (
SELECT *,
calculate_staker_proportion(staker_weight, total_weight) as staker_proportion
staker_weight(staker_weight, total_weight) as staker_proportion
FROM staker_weight_sum
),
-- Calculate total tokens to the (staker, operator) pair
Expand Down
691 changes: 570 additions & 121 deletions internal/sqlite/sqlite_test.go

Large diffs are not rendered by default.

559 changes: 0 additions & 559 deletions internal/types/numbers/numbersData_test.go

This file was deleted.

734 changes: 0 additions & 734 deletions internal/types/numbers/numbers_test.go

Large diffs are not rendered by default.

133 changes: 0 additions & 133 deletions internal/types/numbers/tokenCalculations.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/rewards/2_goldStakerRewardAmounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ staker_weight_sum AS (
-- Calculate staker proportion of tokens for each reward and snapshot
staker_proportion AS (
SELECT *,
calculate_staker_proportion(staker_weight, total_weight) as staker_proportion
staker_weight(staker_weight, total_weight) as staker_proportion
FROM staker_weight_sum
),
-- Calculate total tokens to the (staker, operator) pair
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/4_goldRewardsForAll.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ staker_weight_sum AS (
-- Calculate staker token proportion
staker_proportion AS (
SELECT *,
calculate_staker_proportion(staker_weight, total_staker_weight) as staker_proportion
staker_weight(staker_weight, total_staker_weight) as staker_proportion
FROM staker_weight_sum
),
-- Calculate total tokens to staker
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/5_goldRfaeStakers.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ staker_weight_sum AS (
-- Calculate staker proportion of tokens for each reward and snapshot
staker_proportion AS (
SELECT *,
calculate_staker_proportion(staker_weight, total_weight) as staker_proportion
staker_weight(staker_weight, total_weight) as staker_proportion
FROM staker_weight_sum
),
-- Calculate total tokens to the (staker, operator) pair
Expand Down
5 changes: 0 additions & 5 deletions pkg/rewards/rewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/Layr-Labs/go-sidecar/internal/sqlite/migrations"
"github.com/Layr-Labs/go-sidecar/internal/tests"
"github.com/Layr-Labs/go-sidecar/internal/tests/sqlite"
"github.com/Layr-Labs/go-sidecar/internal/types/numbers"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"gorm.io/gorm"
Expand Down Expand Up @@ -137,10 +136,6 @@ func Test_Rewards(t *testing.T) {
return
}

if err := numbers.InitPython(); err != nil {
t.Fatal(err)
}

dbFileName, cfg, grm, l, err := setupRewards()
fmt.Printf("Using db file: %+v\n", dbFileName)

Expand Down

0 comments on commit e1b5582

Please sign in to comment.