Skip to content

diamondhands rosetta review 2024-02-26 - #69

Open
diamondhands0 wants to merge 1 commit into
mainfrom
diamondhands/ROSETTA-REVIEW-2024-02-26
Open

diamondhands rosetta review 2024-02-26#69
diamondhands0 wants to merge 1 commit into
mainfrom
diamondhands/ROSETTA-REVIEW-2024-02-26

Conversation

@diamondhands0

Copy link
Copy Markdown
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
Comment thread deso/index.go
default:
panic("unknown balance type")
}
}

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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.

Comment thread deso/index.go
@@ -24,171 +24,238 @@ const (

Copy link
Copy Markdown
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.

Comment thread deso/index.go

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

func (index *RosettaIndex) PutHypersyncBlockBalances(

Copy link
Copy Markdown
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.

Comment thread deso/events.go
glog.Errorf("PutLockedStakeBalanceSnapshot: %v", err)
}

// TODO: Add support for locked DESO balance entries via coin lockups here.

Copy link
Copy Markdown
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.

Comment thread deso/block.go

// 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
Copy Markdown
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
Copy Markdown
Contributor

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.

return nil, wrapErr(ErrDeSo, err)
}

// TODO: Hook up new PosMempool

Copy link
Copy Markdown
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