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

diamondhands rosetta review 2024-02-26 #69

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

diamondhands0
Copy link
Member

No description provided.

@diamondhands0 diamondhands0 changed the base branch from main to feature/proof-of-stake February 26, 2024 16:08
@diamondhands0 diamondhands0 force-pushed the diamondhands/ROSETTA-REVIEW-2024-02-26 branch from 304c35e to b410d43 Compare February 26, 2024 16:22
@diamondhands0 diamondhands0 force-pushed the diamondhands/ROSETTA-REVIEW-2024-02-26 branch from b410d43 to 475aa1a Compare February 26, 2024 16:27
@diamondhands0 diamondhands0 changed the base branch from feature/proof-of-stake to main February 26, 2024 16:28
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Nit: I think this would work just fine and be less "magic number"-ey if we replaced it with:
return byte(balanceType.BalanceTypePrefix()). So the Hypersync prefixes are actually just: {PrefixHypersyncBlockHeightToBalances, whatever the balance prefix is}.

Whole function would look like this:

func (balanceType BalanceType) HypersyncBalanceTypePrefix() byte {
	return byte(balanceType.BalanceTypePrefix())
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually you could just delete this function and use byte(balanceType.BalanctTypePrefix()) in its place.

Copy link
Member

Choose a reason for hiding this comment

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

No we can't use byte(balanceType.BalanceTypePrefix()) as this breaks backwards compatibility. We can use byte(balanceType) if you prefer.

@@ -24,171 +24,238 @@ const (

Copy link
Member Author

Choose a reason for hiding this comment

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

Nit: Add a comment that PrefixUtxoOps is no longer used because we now pull UtxoOps from the node's BadgerDB.

return prefix
}

func (index *RosettaIndex) PutHypersyncBlockBalances(blockHeight uint64, isLocked bool, balances map[lib.PublicKey]uint64) {

func (index *RosettaIndex) PutHypersyncBlockBalances(
Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed, you'll need to change these Puts to take a WriteBatch or whatever but I'll assume we'll handle this in a follow-up PR.

glog.Errorf("PutLockedStakeBalanceSnapshot: %v", err)
}

// TODO: Add support for locked DESO balance entries via coin lockups here.
Copy link
Member Author

Choose a reason for hiding this comment

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

Delete this comment as we no longer need to support this.

@@ -563,6 +690,10 @@ func (node *Node) getSwapIdentityOps(txn *lib.MsgDeSoTxn, utxoOpsForTxn []*lib.U
},
})

// TODO: Do we need to do this for ValidatorEntry and LockedStakeEntries as well? If so,
// we'll need to expose add ToValidatorEntry, FromValidatorEntry, ToLockedStakeEntries, and
// FromLockedStakeEntries to the UtxoOperation.
Copy link
Member Author

Choose a reason for hiding this comment

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

Oof this is annoying. I think unfortunately we need to swap the following things in the case of SwapIdentity:

  1. The stake amounts of the two validators that we're swapping, since validators are indexed by pkid
  2. All of the LockedBalanceEntries, since they're also indexed by pkid

Alternatively, we can disable SwapIdentity after the PoS cutover. I'll float this for discussion in Slack.

Copy link
Member

Choose a reason for hiding this comment

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

This comment should have been deleted. ValidatorEntry and LockedStakeEntry are tracked by PKID so we don't need to do anything when a swap identity occurs.

@@ -57,6 +59,7 @@ func accountBalanceCurrent(node *deso.Node, account *types.AccountIdentifier) (*
return nil, wrapErr(ErrDeSo, err)
}

// TODO: Hook up new PosMempool
Copy link
Member Author

Choose a reason for hiding this comment

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

You don't need this comment anymore right?

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.

2 participants