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

fix scheduled rewards for f4 address #265

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions commands/station.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { metrics } from '../lib/metrics.js'
import { paths } from '../lib/paths.js'
import pRetry from 'p-retry'
import { fetch } from 'undici'
import { ethAddressFromDelegated } from '@glif/filecoin-address'

const { FIL_WALLET_ADDRESS } = process.env

Expand Down Expand Up @@ -42,6 +43,9 @@ export const station = async ({ json, experimental }) => {
)
if (fetchRes.status === 403) panic('Invalid FIL_WALLET_ADDRESS address')
if (!fetchRes.ok) panic('Failed to check FIL_WALLET_ADDRESS address')
const ethAddress = FIL_WALLET_ADDRESS.startsWith('0x')
? FIL_WALLET_ADDRESS
: ethAddressFromDelegated(FIL_WALLET_ADDRESS)

startPingLoop().unref()
for (const moduleName of moduleNames) {
Expand Down Expand Up @@ -75,6 +79,7 @@ export const station = async ({ json, experimental }) => {
const modules = [
pRetry(() => zinniaRuntime.run({
FIL_WALLET_ADDRESS,
ethAddress,
STATE_ROOT: join(paths.moduleState, 'zinnia'),
CACHE_ROOT: join(paths.moduleCache, 'zinnia'),
onActivity: activity => {
Expand Down
8 changes: 4 additions & 4 deletions lib/zinnia.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export async function install () {

export async function run ({
FIL_WALLET_ADDRESS,
ethAddress,
STATE_ROOT,
CACHE_ROOT,
onActivity,
Expand Down Expand Up @@ -80,7 +81,7 @@ export async function run ({
childProcess.stdout.on('data', data => {
handleEvents({
contract,
FIL_WALLET_ADDRESS,
ethAddress,
onActivity,
onMetrics,
text: data
Expand Down Expand Up @@ -121,7 +122,7 @@ export async function run ({

async function handleEvents ({
contract,
FIL_WALLET_ADDRESS,
ethAddress,
onActivity,
onMetrics,
text
Expand Down Expand Up @@ -150,8 +151,7 @@ async function handleEvents ({
onMetrics({
totalJobsCompleted: event.total,
rewardsScheduledForAddress:
(await contract.rewardsScheduledFor(FIL_WALLET_ADDRESS))
.toString()
(await contract.rewardsScheduledFor(ethAddress)).toString()
})
break

Expand Down
Loading