Skip to content

Commit

Permalink
Merge pull request #23 from TxnLab/dev
Browse files Browse the repository at this point in the history
0.3.0
  • Loading branch information
pbennett authored Apr 5, 2024
2 parents 0880fcd + 8042026 commit bd5b1f4
Show file tree
Hide file tree
Showing 16 changed files with 137 additions and 131 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ name: CI Workflow (UI)
on:
push:
branches: [ dev, main ]
paths:
- 'ui/**'
# - '.github/workflows/ci-ui.yaml'

pull_request:
branches: [ dev, main ]
paths:
- 'ui/**'
# - '.github/workflows/ci-ui.yaml'

jobs:
run-ci:
if: "!contains(github.event.head_commit.message, 'chore: release v')"
name: Lint, Typecheck, Test, and Build
runs-on: ubuntu-latest

Expand Down
19 changes: 0 additions & 19 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap",
"version": "0.2.1",
"version": "0.3.0",
"description": "",
"main": "index.ts",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reti-contracts",
"version": "0.2.1",
"version": "0.3.0",
"license": "MIT",
"scripts": {
"generate-client": "algokit generate client contracts/artifacts/ --language typescript --output contracts/clients/{contract_name}Client.ts && ./update_contract_artifacts.sh``",
Expand Down
29 changes: 18 additions & 11 deletions nodemgr/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
const (
OnlineStatus = "Online"
GeneratedKeyLengthInDays = 7
DaysPriorToExpToRenew = 1
)

// Daemon provides a 'little' separation in that we initalize it with some data from the App global set up by
Expand Down Expand Up @@ -318,9 +319,7 @@ func (d *Daemon) removeExpiredKeys(ctx context.Context, partKeys algo.PartKeysBy
misc.Infof(d.logger, "key:%s for account:%s is expired, removing", key.Id, key.Address)
err = algo.DeleteParticipationKey(ctx, d.algoClient, d.logger, key.Id)
if err != nil {
if err != nil {
return false, fmt.Errorf("error deleting participation key for id:%s, err:%w", key.Id, err)
}
return false, fmt.Errorf("error deleting participation key for id:%s, err:%w", key.Id, err)
}
anyRemoved = true
}
Expand Down Expand Up @@ -365,7 +364,7 @@ func (d *Daemon) ensureParticipation(ctx context.Context, poolAccounts map[strin

// Handle: account has NO local participation key (online or offline)
func (d *Daemon) ensureParticipationNoKeysYet(ctx context.Context, poolAccounts map[string]onlineInfo, partKeys algo.PartKeysByAddress) error {
for account, _ := range poolAccounts {
for account := range poolAccounts {
// for accounts w/ no keys at all - we just create keys - we'll go online as part of later checks
if _, found := partKeys[account]; !found {
_, err := d.createPartKey(ctx, account, 0)
Expand All @@ -380,7 +379,7 @@ func (d *Daemon) ensureParticipationNoKeysYet(ctx context.Context, poolAccounts
}

// Handle: account is NOT online but has one or more part keys - go online against newest
func (d *Daemon) ensureParticipationNotOnline(ctx context.Context, poolAccounts map[string]onlineInfo, partKeys algo.PartKeysByAddress) error {
func (d *Daemon) ensureParticipationNotOnline(_ context.Context, poolAccounts map[string]onlineInfo, partKeys algo.PartKeysByAddress) error {
var (
err error
managerAddr, _ = types.DecodeAddress(App.retiClient.Info().Config.Manager)
Expand All @@ -401,9 +400,9 @@ func (d *Daemon) ensureParticipationNotOnline(ctx context.Context, poolAccounts

err = App.retiClient.GoOnline(info.poolAppId, managerAddr, keyToUse.Key.VoteParticipationKey, keyToUse.Key.SelectionParticipationKey, keyToUse.Key.StateProofKey, keyToUse.Key.VoteFirstValid, keyToUse.Key.VoteLastValid, keyToUse.Key.VoteKeyDilution)
if err != nil {
return fmt.Errorf("unable to go online for account:%s [pool app id:%d], err:%w", account, info.poolAppId, err)
return fmt.Errorf("unable to go online for key:%s, account:%s [pool app id:%d], err:%w", keyToUse.Id, account, info.poolAppId, err)
}
misc.Infof(d.logger, "participation key went online for account:%s [pool app id:%d]", account, info.poolAppId)
misc.Infof(d.logger, "participation key:%s went online for account:%s [pool app id:%d]", keyToUse.Id, account, info.poolAppId)
}
}
return nil
Expand Down Expand Up @@ -439,10 +438,14 @@ func (d *Daemon) ensureParticipationCheckNeedsRenewed(ctx context.Context, poolA
continue
}
expValidDistance := time.Duration(activeKey.Key.VoteLastValid-curRound) * avgBlockTime
if expValidDistance.Hours() < 24*7 {
if expValidDistance.Hours() <= 24*DaysPriorToExpToRenew {
oneDayOfBlocks := (24 * time.Hour) / avgBlockTime
misc.Infof(d.logger, "activeKey: %s for %s expiring in %v, creating new key with ~1 day lead-time", activeKey.Id, activeKey.Address, expValidDistance)
d.createPartKey(ctx, account, activeKey.Key.VoteLastValid-uint64(oneDayOfBlocks))
_, err = d.createPartKey(ctx, account, activeKey.Key.VoteLastValid-uint64(oneDayOfBlocks))
if err != nil {
d.logger.Warn("failure in creating new key w/in ensureParticipationCheckNeedsRenewed", "error", err)
continue
}
}
}
}
Expand Down Expand Up @@ -519,8 +522,10 @@ func (d *Daemon) EpochUpdater(ctx context.Context) {

epochMinutes := App.retiClient.Info().Config.PayoutEveryXMins

epochTimer := time.NewTimer(durationToNextEpoch(time.Now(), epochMinutes))
dur := durationToNextEpoch(time.Now(), epochMinutes)
epochTimer := time.NewTimer(dur)
defer epochTimer.Stop()
misc.Infof(d.logger, "First epoch trigger in:%v", dur)

for {
select {
Expand Down Expand Up @@ -561,7 +566,9 @@ func (d *Daemon) EpochUpdater(ctx context.Context) {
func durationToNextEpoch(curTime time.Time, epochMinutes int) time.Duration {
dur := curTime.Round(time.Duration(epochMinutes) * time.Minute).Sub(curTime)
if dur <= 0 {
dur = time.Duration(epochMinutes) * time.Minute
// We've rounded backwards - so go to that rounded time, and then get time from curTime to that future time.
// ie: 12:10:00 hourly epoch - rounds down to 12:00:00 but next epoch is 13:00:00, so duration should be 50 minutes.
dur = curTime.Add(dur).Add(time.Duration(epochMinutes) * time.Minute).Sub(curTime)
}
slog.Debug(fmt.Sprintf("%v epoch duration in mins:%d, dur to next epoch:%v", curTime, epochMinutes, dur))
return dur
Expand Down
7 changes: 4 additions & 3 deletions nodemgr/daemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ func TestDurationToNextEpochRefactored(t *testing.T) {
currentTime time.Time
expectedDurMin float64
}{
{"11:10:15->12:00:00", 60, time.Date(2024, 1, 1, 11, 10, 15, 0, time.UTC), 60.0},
{"11:10:15->12:00:00", 60, time.Date(2024, 1, 1, 11, 10, 15, 0, time.UTC), 49.75},
{"12:09:30->13:00:00", 60, time.Date(2024, 1, 1, 12, 9, 30, 0, time.UTC), 50.5},
{"11:55:55->12:00:00", 60, time.Date(2024, 1, 1, 11, 55, 15, 0, time.UTC), 4.75},
{"00:00:00->01:00:00", 15, time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC), 15.0},
{"00:15:30->00:30:00", 15, time.Date(2024, 1, 1, 0, 15, 30, 0, time.UTC), 15.0},
{"00:30:45->00:45:00", 15, time.Date(2024, 1, 1, 0, 30, 45, 0, time.UTC), 15.0},
{"00:15:30->00:30:00", 15, time.Date(2024, 1, 1, 0, 15, 30, 0, time.UTC), 14.5},
{"00:30:45->00:45:00", 15, time.Date(2024, 1, 1, 0, 30, 45, 0, time.UTC), 14.25},
{"00:45:00->01:00:00", 15, time.Date(2024, 1, 1, 0, 45, 0, 0, time.UTC), 15.0},
{"00:07:30->00:15:00", 15, time.Date(2024, 1, 1, 0, 7, 30, 0, time.UTC), 7.5},
{"00:15:00->00:30:00", 30, time.Date(2024, 1, 1, 0, 15, 0, 0, time.UTC), 15.0},
Expand Down
12 changes: 5 additions & 7 deletions nodemgr/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ require (
github.com/manifoldco/promptui v0.9.0
github.com/prometheus/client_golang v1.19.0
github.com/ssgreg/repeat v1.5.1
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/urfave/cli/v3 v3.0.0-alpha9
golang.org/x/crypto v0.21.0
golang.org/x/oauth2 v0.18.0
golang.org/x/term v0.18.0
golang.org/x/crypto v0.22.0
golang.org/x/oauth2 v0.19.0
golang.org/x/term v0.19.0
)

require (
Expand All @@ -24,16 +24,14 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.50.0 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect
golang.org/x/sys v0.18.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
golang.org/x/sys v0.19.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
38 changes: 10 additions & 28 deletions nodemgr/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
Expand Down Expand Up @@ -67,61 +62,48 @@ github.com/ssgreg/repeat v1.5.1 h1:8OjfXKWnFU9cL1cI+2UCdPpOpGOEax1oZ1FQdylri+8=
github.com/ssgreg/repeat v1.5.1/go.mod h1:V1zMJmma0AQitsevwH3wM/uFcIw6VxW0dHBJBhajl/o=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/urfave/cli/v3 v3.0.0-alpha9 h1:P0RMy5fQm1AslQS+XCmy9UknDXctOmG/q/FZkUFnJSo=
github.com/urfave/cli/v3 v3.0.0-alpha9/go.mod h1:0kK/RUFHyh+yIKSfWxwheGndfnrvYSmYFVeKCh03ZUc=
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e h1:+SOyEddqYF09QP7vr7CgJ1eti3pY9Fn3LHO1M1r/0sI=
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI=
golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8=
golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg=
golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
20 changes: 19 additions & 1 deletion nodemgr/internal/lib/reti/stakingpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ func (r *Reti) EpochBalanceUpdate(poolID int, poolAppID uint64, caller types.Add
newParams.FlatFee = true
newParams.Fee = 0

// we need to stack up references in this gas method for resource pooling
extraApps := []uint64{}

if r.info.Config.NFDForInfo != 0 {
extraApps = append(extraApps, r.info.Config.NFDForInfo)
}

// we need to stack up references in these two gas methods for resource pooling
err = atc.AddMethodCall(transaction.AddMethodCallParams{
AppID: poolAppID,
Method: gasMethod,
Expand All @@ -165,6 +171,18 @@ func (r *Reti) EpochBalanceUpdate(poolID int, poolAppID uint64, caller types.Add
if err != nil {
return atc, err
}
err = atc.AddMethodCall(transaction.AddMethodCallParams{
AppID: poolAppID,
Method: gasMethod,
ForeignApps: extraApps,
SuggestedParams: newParams,
OnComplete: types.NoOpOC,
Sender: caller,
Signer: algo.SignWithAccountForATC(r.signer, caller.String()),
})
if err != nil {
return atc, err
}
if feesToUse == 0 {
// we're simulating so go with super high budget
feesToUse = 240 * transaction.MinTxnFee
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reti-ui",
"version": "0.2.1",
"version": "0.3.0",
"author": {
"name": "Doug Richar",
"email": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion ui/src/api/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const validatorQueryOptions = (validatorId: number | string) =>
queryOptions({
queryKey: ['validator', String(validatorId)],
queryFn: () => fetchValidator(validatorId),
// staleTime: Infinity,
refetchInterval: 1000, // 1 min polling on validator info
retry: false,
})

Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/AddValidatorForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function AddValidatorForm({ constraints }: AddValidatorFormProps) {
setIsFetchingAppId(true)

try {
const nfd = await fetchNfd(value, { view: 'tiny' })
const nfd = await fetchNfd(value, { view: 'brief' })

// If we have an app id, clear error if it exists
form.clearErrors('nfdForInfo')
Expand All @@ -112,7 +112,7 @@ export function AddValidatorForm({ constraints }: AddValidatorFormProps) {
const debouncedCheck = useDebouncedCallback(async (value) => {
const isValid = await form.trigger('nfdForInfo')
if (isValid) {
fetchNfdForInfo(value)
await fetchNfdForInfo(value)
}
}, 500)

Expand Down Expand Up @@ -273,7 +273,7 @@ export function AddValidatorForm({ constraints }: AddValidatorFormProps) {
},
)

navigate({ to: '/' })
await navigate({ to: '/' })
} catch (error) {
toast.error('Failed to create validator', { id: toastId })
console.error(error)
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/ValidatorDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ export function ValidatorDetails({ validator }: ValidatorDetailsProps) {
<div className="grid gap-4 lg:grid-cols-7">
<Card className="lg:col-span-4">
<CardHeader>
<CardTitle>Analytics</CardTitle>
<CardTitle>Stake by Pool</CardTitle>
</CardHeader>
<CardContent className="pl-2">
<Overview />
<Overview validator={validator} />
</CardContent>
</Card>
<Card className="lg:col-span-3">
Expand Down
Loading

0 comments on commit bd5b1f4

Please sign in to comment.