Skip to content

Commit

Permalink
change the old kernel node group to universal mint group
Browse files Browse the repository at this point in the history
  • Loading branch information
vanessaviolet committed Jul 6, 2023
1 parent 8d7582a commit 039a22e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 71 deletions.
4 changes: 2 additions & 2 deletions common/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestCommonDataEncoding(t *testing.T) {

mint := &MintDistribution{
MintData: MintData{
Group: MintGroupKernelNode,
Group: MintGroupUniversal,
Batch: 123,
Amount: NewIntegerFromString("3.14159"),
},
Expand All @@ -129,7 +129,7 @@ func TestCommonDataEncoding(t *testing.T) {
assert.Equal("0000000028b52ffd0300c118533ca10100777700010001000000000000007b000412b9af98eea889c227076f8c62106b59a478e043c0030392f3be0f5d714ed27953cb2668", hex.EncodeToString(enc))
res, err := DecompressUnmarshalMintDistribution(enc)
assert.Nil(err)
assert.Equal(MintGroupKernelNode, res.Group)
assert.Equal(MintGroupUniversal, res.Group)
assert.Equal(uint64(123), res.Batch)
assert.Equal("3.14159000", res.Amount.String())
assert.Equal("eea889c227076f8c62106b59a478e043c0030392f3be0f5d714ed27953cb2668", res.Transaction.String())
Expand Down
10 changes: 5 additions & 5 deletions common/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

const (
MintGroupKernelNode = "KERNELNODE"
MintGroupUniversal = "UNIVERSAL"
)

type MintData struct {
Expand Down Expand Up @@ -42,7 +42,7 @@ func (tx *VersionedTransaction) validateMint(store DataStore) error {
}

mint := tx.Inputs[0].Mint
if mint.Group != MintGroupKernelNode {
if mint.Group != MintGroupUniversal {
return fmt.Errorf("invalid mint group %s", mint.Group)
}

Expand All @@ -65,7 +65,7 @@ func (tx *VersionedTransaction) validateMint(store DataStore) error {
func (tx *Transaction) AddKernelNodeMintInput(batch uint64, amount Integer) {
tx.Inputs = append(tx.Inputs, &Input{
Mint: &MintData{
Group: MintGroupKernelNode,
Group: MintGroupUniversal,
Batch: batch,
Amount: amount,
},
Expand All @@ -87,7 +87,7 @@ func DecompressUnmarshalMintDistribution(b []byte) (*MintDistribution, error) {
func (m *MintDistribution) Marshal() []byte {
enc := NewMinimumEncoder()
switch m.Group {
case MintGroupKernelNode:
case MintGroupUniversal:
enc.WriteUint16(0x1)
default:
panic(m.Group)
Expand Down Expand Up @@ -116,7 +116,7 @@ func UnmarshalMintDistribution(b []byte) (*MintDistribution, error) {
}
switch group {
case 0x1:
m.Group = MintGroupKernelNode
m.Group = MintGroupUniversal
default:
return nil, fmt.Errorf("invalid mint distribution group %d", group)
}
Expand Down
59 changes: 0 additions & 59 deletions custodian/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion kernel/election.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func (node *Node) validateNodeAcceptSnapshot(s *common.Snapshot, tx *common.Vers

func (node *Node) reloadConsensusState(s *common.Snapshot, tx *common.VersionedTransaction) error {
if tx.TransactionType() == common.TransactionTypeMint {
mint, err := node.persistStore.ReadLastMintDistribution(common.MintGroupKernelNode)
mint, err := node.persistStore.ReadLastMintDistribution(common.MintGroupUniversal)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions kernel/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (node *Node) MintLoop() {
}

func (node *Node) PoolSize() (common.Integer, error) {
dist, err := node.persistStore.ReadLastMintDistribution(common.MintGroupKernelNode)
dist, err := node.persistStore.ReadLastMintDistribution(common.MintGroupUniversal)
if err != nil {
return common.Zero, err
}
Expand Down Expand Up @@ -296,7 +296,7 @@ func (node *Node) checkMintPossibility(timestamp uint64, validateOnly bool) (int
light := total.Div(10)
full := light.Mul(9)

dist, err := node.persistStore.ReadLastMintDistribution(common.MintGroupKernelNode)
dist, err := node.persistStore.ReadLastMintDistribution(common.MintGroupUniversal)
if err != nil {
logger.Verbosef("ReadLastMintDistribution ERROR %s\n", err)
return 0, common.Zero
Expand Down
2 changes: 1 addition & 1 deletion kernel/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func SetupNode(custom *config.Custom, persistStore storage.Store, cacheStore *ri

node.LoadNodeConfig()

mint, err := node.persistStore.ReadLastMintDistribution(common.MintGroupKernelNode)
mint, err := node.persistStore.ReadLastMintDistribution(common.MintGroupUniversal)
if err != nil {
return nil, fmt.Errorf("ReadLastMintDistribution() => %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion rpc/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func listMintDistributions(store storage.Store, params []any) ([]map[string]any,
return nil, err
}

mints, transactions, err := store.ReadMintDistributions(common.MintGroupKernelNode, offset, count)
mints, transactions, err := store.ReadMintDistributions(common.MintGroupUniversal, offset, count)
return mintsToMap(mints, transactions, tx), err
}

Expand Down

0 comments on commit 039a22e

Please sign in to comment.