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

all: rework genesis api #567

Conversation

Francesco4203
Copy link
Contributor

@Francesco4203 Francesco4203 commented Sep 9, 2024

This PR refers to the 2 following PRs:

* core: store genesis allocation and recommit them if necessary

* core: recover predefined genesis allocation if possible
* all: polish tests

* core: apply feedback from Guillaume

* core: fix comment
@huyngopt1994
Copy link
Collaborator

huyngopt1994 commented Sep 10, 2024

Founding some places impacted to rewind logic here, maybe need to retest again after merging.

  • Call SetHead Api
  • Head State Missing

genesis = DefaultGoerliGenesisBlock()
case params.SepoliaGenesisHash:
genesis = DefaultSepoliaGenesisBlock()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could u recheck all params when recommit genesis to disk?

statedb.SetState(addr, key, value)
}
}
root := statedb.IntermediateRoot(false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it safe to remove the recalculated root in this line?

Copy link
Collaborator

Choose a reason for hiding this comment

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

	root, err := g.Alloc.flush(db)
	if err != nil {
		panic(err)
	}

The root is calculated by flush logic which is committed, so we don't need to callI IntermediateRoot here 🤔

@huyngopt1994
Copy link
Collaborator

I rechecked the logic of refactoring, seem it's safe for merging. LGTM.

@huyngopt1994 huyngopt1994 merged commit f69fce6 into axieinfinity:path-base-implementing Sep 10, 2024
1 check passed
Francesco4203 added a commit to Francesco4203/ronin that referenced this pull request Sep 16, 2024
* core: store genesis allocation and recommit them if necessary (#24460)

* core: store genesis allocation and recommit them if necessary

* core: recover predefined genesis allocation if possible

* all: cleanup the APIs for initializing genesis (#25473)

* all: polish tests

* core: apply feedback from Guillaume

* core: fix comment

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
huyngopt1994 pushed a commit that referenced this pull request Sep 17, 2024
* core: store genesis allocation and recommit them if necessary (#24460)

* core: store genesis allocation and recommit them if necessary

* core: recover predefined genesis allocation if possible

* all: cleanup the APIs for initializing genesis (#25473)

* all: polish tests

* core: apply feedback from Guillaume

* core: fix comment

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
huyngopt1994 pushed a commit that referenced this pull request Oct 25, 2024
* core: store genesis allocation and recommit them if necessary (#24460)

* core: store genesis allocation and recommit them if necessary

* core: recover predefined genesis allocation if possible

* all: cleanup the APIs for initializing genesis (#25473)

* all: polish tests

* core: apply feedback from Guillaume

* core: fix comment

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
huyngopt1994 pushed a commit that referenced this pull request Nov 21, 2024
* core: store genesis allocation and recommit them if necessary (#24460)

* core: store genesis allocation and recommit them if necessary

* core: recover predefined genesis allocation if possible

* all: cleanup the APIs for initializing genesis (#25473)

* all: polish tests

* core: apply feedback from Guillaume

* core: fix comment

---------

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
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.

3 participants