Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Support genesis contract code #749

Merged
merged 3 commits into from
Feb 3, 2019
Merged

Conversation

kziemianek
Copy link
Contributor

PR description

Support for contract code read from genesis file.

Fixed Issue(s)

fixes: #662

@CLAassistant
Copy link

CLAassistant commented Feb 3, 2019

CLA assistant check
All committers have signed the CLA.

@@ -85,6 +85,19 @@ public void createFromJsonNoAllocs() throws Exception {
assertThat(header.getParentHash()).isEqualTo(Hash.ZERO);
}

@Test
public void createFromJsonWithContract() throws Exception {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I might remove this test and edit createFromJsonWithAllocs but i left it here in order to prove that it passes the case described in issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it could go either way but I think it's worth having a test that covers this more complex case specifically. I've added a few assertions for the contract account's code and storage for good measure.

@ajsutton ajsutton self-assigned this Feb 3, 2019
 * Use final for local variables
 * Use most general applicable interface for variable declaration (Map instead of LinkedHashMap)
 * Use a plain HashMap instead of LinkedHashMap as order doesn't actually matter
 * Take advantage of Map.forEach to improve readability.
 * Regenerate GenesisAccount.toString so it includes the additional fields.
 * Remove unnecessary @SuppressWarnings annotations.
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution - extremely helpful. I've applied a few minor tweaks in GenesisState (see 2241271) just to follow the typical conventions we use (or at lest try to stick with). All just small details though.

Welcome to the Pantheon contributors club. :)

@@ -85,6 +85,19 @@ public void createFromJsonNoAllocs() throws Exception {
assertThat(header.getParentHash()).isEqualTo(Hash.ZERO);
}

@Test
public void createFromJsonWithContract() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it could go either way but I think it's worth having a test that covers this more complex case specifically. I've added a few assertions for the contract account's code and storage for good measure.

@ajsutton ajsutton merged commit 26f5fd0 into PegaSysEng:master Feb 3, 2019
@MadelineMurray MadelineMurray mentioned this pull request Feb 4, 2019
rain-on pushed a commit to rain-on/pantheon that referenced this pull request Feb 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants