Skip to content

internal/ethapi,params: add eth_config#32239

Merged
gballet merged 11 commits intoethereum:masterfrom
lightclient:ethapi-add-config
Sep 1, 2025
Merged

internal/ethapi,params: add eth_config#32239
gballet merged 11 commits intoethereum:masterfrom
lightclient:ethapi-add-config

Conversation

@lightclient
Copy link
Copy Markdown
Member

@lightclient lightclient commented Jul 18, 2025

Will probably be mostly supplanted by #32224, but this should do for now for devnet 3.

Seems like #32224 is going to take some more time, so I have completed the implementation of eth_config here. It is quite a bit simpler to implement now that the config hashing was removed.

Comment thread params/config.go Outdated

switch {
case c.IsOsaka(london, time):
next = c.OsakaTime
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wouldn't it be better to return something like Maxuint64 here

Comment thread internal/ethapi/api.go
Comment thread internal/ethapi/api.go
Comment thread core/vm/contracts.go Outdated
Comment thread core/vm/contracts.go Outdated
Comment thread core/vm/contracts.go Outdated
Comment thread core/vm/contracts.go Outdated
Comment thread core/vm/contracts.go Outdated
Comment thread core/vm/contracts.go Outdated
@lightclient
Copy link
Copy Markdown
Member Author

Implementation seems correct now, working on some tests.

@lightclient
Copy link
Copy Markdown
Member Author

Should be ready to go, PTAL!

Comment thread internal/jsre/deps/web3.js Outdated
Copy link
Copy Markdown
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

LGTM, small nit

Comment thread internal/ethapi/api.go Outdated
@lightclient lightclient changed the title Add eth_config internal/ethapi,params: add eth_config Aug 27, 2025
Comment thread internal/ethapi/api.go
Comment thread internal/ethapi/api.go
Comment thread internal/ethapi/api.go Outdated
}
forkid := forkid.NewID(c, types.NewBlockWithHeader(genesis), ^uint64(0), t).Hash
return &config{
ActivationTime: t,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Activation time is required. If a fork is activated at genesis the value 0 is used. If the fork is not scheduled to be activated or its activation time is unknown it should not be in the rpc results.

Fix like this?

diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index eb662f9a71..9f2e84c194 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -1188,9 +1188,14 @@ func (api *BlockChainAPI) Config(ctx context.Context) (*configResponse, error) {
 		for addr, c := range vm.ActivePrecompiledContracts(rules) {
 			precompiles[c.Name()] = addr
 		}
+		// Activation time is required. If a fork is activated at genesis the value 0 is used
+		activateTime := t
+		if genesis.Time >= t {
+			activateTime = 0
+		}
 		forkid := forkid.NewID(c, types.NewBlockWithHeader(genesis), ^uint64(0), t).Hash
 		return &config{
-			ActivationTime:  t,
+			ActivationTime:  activateTime,
 			BlobSchedule:    c.BlobConfig(c.LatestFork(t)),
 			ChainId:         (*hexutil.Big)(c.ChainID),
 			ForkId:          forkid[:],

@rjl493456442
Copy link
Copy Markdown
Member

One nit, otherwise lgtm

@gballet gballet added this to the 1.16.3 milestone Sep 1, 2025
Comment thread internal/ethapi/api.go Outdated
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Copy link
Copy Markdown
Member

@gballet gballet left a comment

Choose a reason for hiding this comment

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

LGTM

@gballet gballet merged commit ffe758c into ethereum:master Sep 1, 2025
5 of 6 checks passed
gballet added a commit to gballet/go-ethereum that referenced this pull request Sep 11, 2025
~Will probably be mostly supplanted by ethereum#32224, but this should do for
now for devnet 3.~

Seems like ethereum#32224 is going to take some more time, so I have completed
the implementation of eth_config here. It is quite a bit simpler to
implement now that the config hashing was removed.

---------

Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Sahil-4555 pushed a commit to Sahil-4555/go-ethereum that referenced this pull request Oct 12, 2025
~Will probably be mostly supplanted by ethereum#32224, but this should do for
now for devnet 3.~

Seems like ethereum#32224 is going to take some more time, so I have completed
the implementation of eth_config here. It is quite a bit simpler to
implement now that the config hashing was removed.

---------

Co-authored-by: MariusVanDerWijden <m.vanderwijden@live.de>
Co-authored-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants