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

Added exchageRate, quaiToQi and qiToQuai in header #2166

Closed

Conversation

kiltsonfire
Copy link
Contributor

No description provided.


ExchangeRate = big.NewInt(1000000000000000) // This is the initial exchange rate in Qi per Quai in Its/Qit
// These numbers should be "equivalent" to the initial conversion rate
QuaiToQiConversionBase = big.NewInt(10000000) // Is the starting "historical conversion" in Qits for 10,000 Quai we need 10,000*1e3
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment references units of Qits but this is QuaiToQi

Copy link
Contributor

Choose a reason for hiding this comment

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

Just ignoring this as, this is still to be worked on, @kiltsonfire will fix it during the addition of new feature

@@ -1264,6 +1264,44 @@ func (w *worker) prepareWork(genParams *generateParams, wo *types.WorkObject) (*
newWo.Header().SetInterlinkRootHash(interlinkRootHash)
}

// Calculate the new Qi/Quai exchange rate
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you calculated the new rate here. Is this a todo?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, its todo

@@ -114,6 +114,9 @@ type Header struct {
extra []byte `json:"extraData" gencodec:"required"`
stateLimit uint64 `json:"stateLimit" gencodec:"required"`
stateUsed uint64 `json:"stateUsed" gencodec:"required"`
exchangeRate *big.Int `json:"exchangeRate" gencodec:"required"`
quaiToQi *big.Int `json:"quaiToQi" gencodec:"required"`
Copy link
Member

Choose a reason for hiding this comment

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

Why do you put both of these in the header? won't they always be the inverse of each other?

// protoc-gen-go v1.34.2
// protoc v5.28.2
// protoc-gen-go v1.27.1
// protoc v3.12.4
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update the protoc version, this is two major releases behind and changes the content.

core/genesis.go Show resolved Hide resolved
// protoc-gen-go v1.34.2
// protoc v5.28.2
// protoc-gen-go v1.27.1
// protoc v3.12.4
Copy link
Contributor

Choose a reason for hiding this comment

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

Same proto comment

@@ -898,6 +898,7 @@ func (sl *Slice) combinePendingHeader(header *types.WorkObject, slPendingHeader
combinedPendingHeader.Header().SetExpansionNumber(header.ExpansionNumber())
combinedPendingHeader.Header().SetEtxEligibleSlices(header.EtxEligibleSlices())
combinedPendingHeader.Header().SetInterlinkRootHash(header.InterlinkRootHash())
combinedPendingHeader.Header().SetExchangeRate(header.ExchangeRate())
Copy link
Contributor

Choose a reason for hiding this comment

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

If we do need quaitoqi and qitoquai they should be here as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we need the other two

// protoc-gen-go v1.34.2
// protoc v5.28.2
// protoc-gen-go v1.27.1
// protoc v3.12.4
Copy link
Contributor

Choose a reason for hiding this comment

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

Same proto comment

Copy link
Contributor

Choose a reason for hiding this comment

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

done

}
}
newWo.Header().SetQiToQuai(qiToQuai)
newWo.Header().SetQuaiToQi(quaiToQi)
Copy link
Contributor

Choose a reason for hiding this comment

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

ExchangeRate is missing here

Copy link
Contributor

Choose a reason for hiding this comment

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

added

@@ -114,6 +114,9 @@ type Header struct {
extra []byte `json:"extraData" gencodec:"required"`
stateLimit uint64 `json:"stateLimit" gencodec:"required"`
stateUsed uint64 `json:"stateUsed" gencodec:"required"`
exchangeRate *big.Int `json:"exchangeRate" gencodec:"required"`
Copy link
Member

@wizeguyy wizeguyy Sep 30, 2024

Choose a reason for hiding this comment

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

How is exchangeRate different from quaiToQi (or maybe its qiToQuai)?

@gameofpointers
Copy link
Contributor

closing this PR in favor of this #2174

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