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

enhancement: add genesis type #443

Merged
merged 12 commits into from
Jan 3, 2023
Merged

enhancement: add genesis type #443

merged 12 commits into from
Jan 3, 2023

Conversation

shiqizng
Copy link
Contributor

@shiqizng shiqizng commented Dec 8, 2022

adding genesis type

assert.Equal(t, base64.StdEncoding.EncodeToString(json.Encode(genesis)), base64.StdEncoding.EncodeToString([]byte(genesisStr)))
}

func TestGenesis_Balances(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

test copied from go-algorand

@shiqizng shiqizng changed the title genesis type enhancement: add genesis type Dec 8, 2022
@shiqizng shiqizng self-assigned this Dec 8, 2022
@shiqizng shiqizng requested a review from winder December 8, 2022 17:20
Comment on lines 13 to 18
func TestEncodeDecodeGenesis(t *testing.T) {
genesisStr := "{\n \"alloc\": [\n {\n \"addr\": \"7777777777777777777777777777777777777777777777777774MSJUVU\",\n \"comment\": \"RewardsPool\",\n \"state\": {\n \"algo\": 125000000000000,\n \"onl\": 2\n }\n },\n {\n \"addr\": \"LX6VRFCL4723LRO3VEX5XNOXHFXFQKATKDLDBT5HNT5DFDC3SQG4EI2LSI\",\n \"comment\": \"Wallet1\",\n \"state\": {\n \"algo\": 1000000000000000,\n \"onl\": 1,\n \"sel\": \"XGIljovdG8IjSQJRcvc/vi6UXXTIddUgjZACWZPW23M=\",\n \"vote\": \"zccp6OB5EOh21WMV7A7iVg+CitiZeOao+VYbIkNdPgM=\",\n \"voteKD\": 10000,\n \"voteLst\": 3000000\n }\n }\n ],\n \"fees\": \"A7NMWS3NT3IUDMLVO26ULGXGIIOUQ3ND2TXSER6EBGRZNOBOUIQXHIBGDE\",\n \"id\": \"v1\",\n \"network\": \"sandnet\",\n \"proto\": \"future\",\n \"rwd\": \"7777777777777777777777777777777777777777777777777774MSJUVU\"\n}"
var genesis Genesis
json.Decode([]byte(genesisStr), &genesis)
assert.Equal(t, base64.StdEncoding.EncodeToString(json.Encode(genesis)), base64.StdEncoding.EncodeToString([]byte(genesisStr)))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you generate a hash on algod and confirm that you get the same hash here?


// Timestamp for the genesis block
Timestamp int64 `codec:"timestamp"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We need these too for parity with go-algorand.

Comment string codec:"comment"`

DevMode bool `codec:"devmode"`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

@shiqizng shiqizng marked this pull request as ready for review January 3, 2023 18:09
@shiqizng shiqizng requested a review from Eric-Warehime January 3, 2023 18:09
@shiqizng shiqizng merged commit a935089 into develop Jan 3, 2023
@gmalouf gmalouf deleted the shiqi/genesis branch June 5, 2024 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants