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

Hip-904 account changes supporting pending airdrops #389

Merged
merged 11 commits into from
Jul 22, 2024

Conversation

ibankov
Copy link
Contributor

@ibankov ibankov commented Jul 4, 2024

Description:

Proto changes supporting account relations to pending airdrops

Related issue(s):

Fixes #

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@ibankov ibankov added this to the v0.53 milestone Jul 4, 2024
@ibankov ibankov self-assigned this Jul 4, 2024
@ibankov ibankov requested review from a team as code owners July 4, 2024 11:51
@ibankov ibankov requested review from thomas-swirlds-labs and jnels124 and removed request for a team July 4, 2024 11:51
@ibankov ibankov changed the title Hip 904 account changes Hip-904 account changes supporting pending airdrops Jul 4, 2024
@ibankov ibankov force-pushed the hip-904-account-changes branch from 7d92865 to aa729d1 Compare July 4, 2024 12:17
Copy link

@vtronkov vtronkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except Michael's comment: LGTM

ibankov added 2 commits July 5, 2024 10:07
…es' into hip-904-account-changes

# Conflicts:
#	services/response_code.proto
Copy link
Member

@jsync-swirlds jsync-swirlds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copyright header copied from other files is incorrect, and most of the specification comment wording could use significant improvements.
Small note, the renumbering of Enum entries is permissible in this case, but we should be extremely careful not to do so for any values that are already merged to the main branch.

I've also raised a general concern about the increased state size elsewhere.

services/response_code.proto Outdated Show resolved Hide resolved
services/response_code.proto Outdated Show resolved Hide resolved
services/state/token/account.proto Outdated Show resolved Hide resolved
Comment on lines 41 to 45
/**
* The value of the current airdrop id. SHALL NOT be set for non fungible tokens
*/
PendingAirdropValue pending_airdrop_value = 2;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is purely duplicative. The pending airdrop ID above can be used to look up the pending airdrop value, and should be. Duplicating the value here just increases the number of places that need to be updated and increases the chance that we make a mistake.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed we don't need the value here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this because we are we are changing the state map to be <PendingAirdropId,AccountAirdrop>, do you suggest that we store the amount directly as unit64

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you saying this will replace the existing PendingAirdropValue message in state?
If we're doing that, the HIP needs to change (which should be discussed across teams and include external stakeholders) to include this message, as that is no longer just an "internal" detail.

The existing PendingAirdropValue message only exists to hold a single uint64 value; if we're replacing that message with this one, then we wouldn't need the wrapper and could just store the primitive value here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes only the internal representation, which is an implementation detail. The HAPI messages should not derive from the HIP. Why do you think it needs to be discussed across teams? Does the HIP define how the information is stored in state?

Copy link
Member

@jsync-swirlds jsync-swirlds Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, it describes the storage of pending airdrops as a map from PendingAirdropId to PendingAirdropValue. We can perhaps debate the wisdom of doing so some other time.

I'm not intending to imply we cannot make a change, only that it probably needs some additional discussion at this stage.

The growth of state for pending airdrops was discussed in the HIP review quite a bit, and there was a significant concern that the storage be as small as possible. Whatever changes are made here should probably keep that in mind.

It is, perhaps, worth noting that in-state representation probably ceases to be a purely internal detail with Block Stream. Block Streams are required (as I understand it) to include state changes with sufficient detail that the entire state can be reconstructed on a Block Node, which implies all representations in state affect the Block Stream and future Block Nodes. Any client of a Block Node could probably be affected as well (depending on what that client used from the stream).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will look into updating the HIP, as for this value I think we need to use PendingAirdropValue and not the unit64 as we use PendingAirdropValue in the record file as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a critical point, but there is nothing that requires us to directly match values in state with values in a record file.
As long as records can be created (and we're just passing a Java long to the record builder to do that) we can store things in state very differently from the record files.

services/state/token/account_airdrop.proto Outdated Show resolved Hide resolved
services/state/token/account_airdrop.proto Outdated Show resolved Hide resolved
services/state/token/account_airdrop.proto Outdated Show resolved Hide resolved
services/state/token/account_airdrop.proto Outdated Show resolved Hide resolved
services/state/token/account_airdrop.proto Outdated Show resolved Hide resolved
@ibankov ibankov merged commit 565b0f1 into hip-904-proto-updates Jul 22, 2024
1 check passed
@ibankov ibankov deleted the hip-904-account-changes branch July 22, 2024 12:19
vtronkov added a commit that referenced this pull request Jul 23, 2024
* feat: HIP-904 account changes

Signed-off-by: ibankov <[email protected]>

* add account id to account_airdrop.proto

Signed-off-by: ibankov <[email protected]>

* Refactor account_airdrop.proto

Signed-off-by: ibankov <[email protected]>

* Change Airdrop record value

Signed-off-by: ibankov <[email protected]>

* Doc fixes

Signed-off-by: ibankov <[email protected]>

* Reverting airdrop record to use pending airdrop value

Signed-off-by: ibankov <[email protected]>

* Addressing comments

Signed-off-by: ibankov <[email protected]>

* Fixing numeration

Signed-off-by: ibankov <[email protected]>

---------

Signed-off-by: ibankov <[email protected]>
Co-authored-by: Valentin Tronkov <[email protected]>
vtronkov added a commit that referenced this pull request Jul 23, 2024
* feat: HIP-904 account changes

Signed-off-by: ibankov <[email protected]>

* add account id to account_airdrop.proto

Signed-off-by: ibankov <[email protected]>

* Refactor account_airdrop.proto

Signed-off-by: ibankov <[email protected]>

* Change Airdrop record value

Signed-off-by: ibankov <[email protected]>

* Doc fixes

Signed-off-by: ibankov <[email protected]>

* Reverting airdrop record to use pending airdrop value

Signed-off-by: ibankov <[email protected]>

* Addressing comments

Signed-off-by: ibankov <[email protected]>

* Fixing numeration

Signed-off-by: ibankov <[email protected]>

---------

Signed-off-by: ibankov <[email protected]>
Co-authored-by: Valentin Tronkov <[email protected]>
Signed-off-by: Valentin Tronkov <[email protected]>
@github-staff github-staff deleted a comment from ibankov Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants