-
Notifications
You must be signed in to change notification settings - Fork 79
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
Add client to verifier balance event #1533
Conversation
actors/verifreg/src/emit.rs
Outdated
) -> Result<ActorEvent, ActorError> { | ||
EventBuilder::new() | ||
.typ("verifier-balance") | ||
.field_indexed("verifier", &verifier) | ||
.field("balance", &BigIntSer(balance)) | ||
.field_indexed("client", &client) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the list-of-pairs logical and physical representation of an event, we have two ways to represent an absent field:
- include a k/v pair but the value is nil
- don't include the key at all
I mostly would go for omitting the key rather than including it with a nil value. One argument against this is that it would make it harder to naively splat event k/v pairs into a static structure, e.g. with the handy schema deserialisation tools in some programming languages. However that kind of static schema doesn't work generally anyway - e.g. sector activation events have repeated keys for pieces in a sector. Some custom splatting library could of course be written to interpret repeated keys into lists, etc, but such software could also handle missing keys for options.
So.... omit the field instead?
.field("balance", &BigIntSer(&(verifier_balance - allowance))) | ||
.build()?, | ||
); | ||
if client_resolved.id().is_ok() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably just unwrap. If the client can't be resolved, something is wrong with the test code and it should abort (e.g. the datacap transfer should also fail).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thread 'clients::rejects_unresolved_address' panicked at 'called
Result::unwrap()on an
Errvalue: NonIDAddress', actors/verifreg/tests/harness/mod.rs:242:64
That's why it's in here. But now I don't understand why it's OK to if
the emit and not have an event in this case.
aa2745a
to
0aee536
Compare
9f768be
to
ea9fb24
Compare
rebased and force-pushed some changes in response to review (sorry, got changes and rebase mixed up so you own my changes now @aarshkshah1992!) |
But note: i agree with #1533 (comment) and would consider simply omitting nil clients (unless we expect that this will be a useful filter)? |
Hm. It looks like that test failure is real. |
It is explicitly testing unresolved address behaviour. But I think the test harness is wrong at
It should just not expect any calls or events if the address is unresolvable. |
this is actually from a |
ea9fb24
to
29d7d24
Compare
done |
29d7d24
to
927f968
Compare
Made |
927f968
to
a3d0403
Compare
@rvagg Yes, we're expecting the call to abort as the test is testing the case where client can not be resolved. |
lgtm |
a3d0403
to
8f848a0
Compare
* update to Actor events * changes as per review * remvoe clippy * changes as per new FIP update * Update to latest PR, remove emit:: use from testing * all itests passing and green CI * address review feedback, minimise diff * feat: add term_start to claim events * fix: claim term_start at current epoch, not at deal_start * fix: s/deal_term/claim_term * add client to verifier balance event * fix: make "client" optional on verifier-balance event --------- Co-authored-by: Rod Vagg <rod@vagg.org>
* update to Actor events * changes as per review * remvoe clippy * changes as per new FIP update * Update to latest PR, remove emit:: use from testing * all itests passing and green CI * address review feedback, minimise diff * feat: add term_start to claim events * fix: claim term_start at current epoch, not at deal_start * fix: s/deal_term/claim_term * add client to verifier balance event * fix: make "client" optional on verifier-balance event --------- Co-authored-by: Rod Vagg <rod@vagg.org>
* update to Actor events * changes as per review * remvoe clippy * changes as per new FIP update * Update to latest PR, remove emit:: use from testing * all itests passing and green CI * address review feedback, minimise diff * feat: add term_start to claim events * fix: claim term_start at current epoch, not at deal_start * fix: s/deal_term/claim_term * add client to verifier balance event * fix: make "client" optional on verifier-balance event --------- Co-authored-by: Rod Vagg <rod@vagg.org>
* update to Actor events * changes as per review * remvoe clippy * changes as per new FIP update * Update to latest PR, remove emit:: use from testing * all itests passing and green CI * address review feedback, minimise diff * feat: add term_start to claim events * fix: claim term_start at current epoch, not at deal_start * fix: s/deal_term/claim_term * add client to verifier balance event * fix: make "client" optional on verifier-balance event --------- Co-authored-by: Rod Vagg <rod@vagg.org>
* Updates to Actor events based on community feedback for NV22 (#1531) * update to Actor events * changes as per review * remvoe clippy * changes as per new FIP update * Update to latest PR, remove emit:: use from testing * all itests passing and green CI * address review feedback, minimise diff * feat: add term_start to claim events * fix: claim term_start at current epoch, not at deal_start * fix: s/deal_term/claim_term --------- Co-authored-by: Rod Vagg <rod@vagg.org> * Add client to verifier balance event (#1533) * update to Actor events * changes as per review * remvoe clippy * changes as per new FIP update * Update to latest PR, remove emit:: use from testing * all itests passing and green CI * address review feedback, minimise diff * feat: add term_start to claim events * fix: claim term_start at current epoch, not at deal_start * fix: s/deal_term/claim_term * add client to verifier balance event * fix: make "client" optional on verifier-balance event --------- Co-authored-by: Rod Vagg <rod@vagg.org> --------- Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
* Updates to Actor events based on community feedback for NV22 (#1531) * update to Actor events * changes as per review * remvoe clippy * changes as per new FIP update * Update to latest PR, remove emit:: use from testing * all itests passing and green CI * address review feedback, minimise diff * feat: add term_start to claim events * fix: claim term_start at current epoch, not at deal_start * fix: s/deal_term/claim_term --------- Co-authored-by: Rod Vagg <rod@vagg.org> * Add client to verifier balance event (#1533) * update to Actor events * changes as per review * remvoe clippy * changes as per new FIP update * Update to latest PR, remove emit:: use from testing * all itests passing and green CI * address review feedback, minimise diff * feat: add term_start to claim events * fix: claim term_start at current epoch, not at deal_start * fix: s/deal_term/claim_term * add client to verifier balance event * fix: make "client" optional on verifier-balance event --------- Co-authored-by: Rod Vagg <rod@vagg.org> --------- Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
This is based on FIP update proposal filecoin-project/FIPs#968
Adding the 'client' field to the verifier balance event makes it easy for users to track datacap allocations by verifiers to clients.