Skip to content

Commit e894b7f

Browse files
authored
feat: add GenesisTimestamp to NetworkParams (#12925)
1 parent e2a790e commit e894b7f

File tree

7 files changed

+26
-5
lines changed

7 files changed

+26
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
- **BREAKING**: Removed `SupportedProofTypes` from `StateGetNetworkParams` response as it was unreliable and didn't match FVM's actual supported proofs ([filecoin-project/lotus#12881](https://github.com/filecoin-project/lotus/pull/12881))
1414
- refactor(eth): attach ToFilecoinMessage converter to EthCall method for improved package/module import structure. This change also exports the converter as a public method, enhancing usability for developers utilizing Lotus as a library. ([filecoin-project/lotus#12844](https://github.com/filecoin-project/lotus/pull/12844))
1515
- feat(f3): Implement contract based parameter setting as for FRC-0099 ([filecoin-project/lotus#12861](https://github.com/filecoin-project/lotus/pull/12861))
16-
1716
- chore: switch to pure-go zstd decoder for snapshot imports. ([filecoin-project/lotus#12857](https://github.com/filecoin-project/lotus/pull/12857))
1817
- feat: automatically detect if the genesis is zstd compressed. ([filecoin-project/lotus#12885](https://github.com/filecoin-project/lotus/pull/12885)
1918
- `lotus send` now supports `--csv` option for sending multiple transactions. ([filecoin-project/lotus#12892](https://github.com/filecoin-project/lotus/pull/12892))
2019
- chore: upgrade to the latest go-f3 and allow F3 chain exchange topics ([filecoin-project/lotus#12893](https://github.com/filecoin-project/lotus/pull/12893)
2120
- chore: upgrade to a minimum Golang version of `1.23.6` ([filecoin-project/lotus#12910](https://github.com/filecoin-project/lotus/pull/12910)
21+
- feat: add `GenesisTimestamp` field to `StateGetNetworkParams` response ([filecoin-project/lotus#12925](https://github.com/filecoin-project/lotus/pull/12925))
2222

2323
# UNRELEASED v.1.32.0
2424

api/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ type NetworkParams struct {
160160
PreCommitChallengeDelay abi.ChainEpoch
161161
ForkUpgradeParams ForkUpgradeParams
162162
Eip155ChainID int
163+
GenesisTimestamp uint64
163164
}
164165

165166
type ForkUpgradeParams struct {

build/openrpc/full.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19970,7 +19970,8 @@
1997019970
"UpgradeTuktukHeight": 10101,
1997119971
"UpgradeTeepHeight": 10101
1997219972
},
19973-
"Eip155ChainID": 123
19973+
"Eip155ChainID": 123,
19974+
"GenesisTimestamp": 42
1997419975
}
1997519976
],
1997619977
"additionalProperties": false,
@@ -20113,6 +20114,10 @@
2011320114
},
2011420115
"type": "object"
2011520116
},
20117+
"GenesisTimestamp": {
20118+
"title": "number",
20119+
"type": "number"
20120+
},
2011620121
"NetworkName": {
2011720122
"type": "string"
2011820123
},

build/openrpc/gateway.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9584,7 +9584,8 @@
95849584
"UpgradeTuktukHeight": 10101,
95859585
"UpgradeTeepHeight": 10101
95869586
},
9587-
"Eip155ChainID": 123
9587+
"Eip155ChainID": 123,
9588+
"GenesisTimestamp": 42
95889589
}
95899590
],
95909591
"additionalProperties": false,
@@ -9727,6 +9728,10 @@
97279728
},
97289729
"type": "object"
97299730
},
9731+
"GenesisTimestamp": {
9732+
"title": "number",
9733+
"type": "number"
9734+
},
97309735
"NetworkName": {
97319736
"type": "string"
97329737
},

documentation/en/api-v0-methods.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4484,7 +4484,8 @@ Response:
44844484
"UpgradeTuktukHeight": 10101,
44854485
"UpgradeTeepHeight": 10101
44864486
},
4487-
"Eip155ChainID": 123
4487+
"Eip155ChainID": 123,
4488+
"GenesisTimestamp": 42
44884489
}
44894490
```
44904491

documentation/en/api-v1-unstable-methods.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6836,7 +6836,8 @@ Response:
68366836
"UpgradeTuktukHeight": 10101,
68376837
"UpgradeTeepHeight": 10101
68386838
},
6839-
"Eip155ChainID": 123
6839+
"Eip155ChainID": 123,
6840+
"GenesisTimestamp": 42
68406841
}
68416842
```
68426843

node/impl/full/state.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,12 +2043,20 @@ func (a *StateAPI) StateGetNetworkParams(ctx context.Context) (*api.NetworkParam
20432043
return nil, err
20442044
}
20452045

2046+
var genesisTimestamp uint64
2047+
if genBlock, err := a.Chain.GetGenesis(ctx); err != nil {
2048+
return nil, xerrors.Errorf("getting genesis: %w", err)
2049+
} else if genBlock != nil {
2050+
genesisTimestamp = genBlock.Timestamp
2051+
}
2052+
20462053
return &api.NetworkParams{
20472054
NetworkName: networkName,
20482055
BlockDelaySecs: buildconstants.BlockDelaySecs,
20492056
ConsensusMinerMinPower: buildconstants.ConsensusMinerMinPower,
20502057
PreCommitChallengeDelay: buildconstants.PreCommitChallengeDelay,
20512058
Eip155ChainID: buildconstants.Eip155ChainId,
2059+
GenesisTimestamp: genesisTimestamp,
20522060
ForkUpgradeParams: api.ForkUpgradeParams{
20532061
UpgradeSmokeHeight: buildconstants.UpgradeSmokeHeight,
20542062
UpgradeBreezeHeight: buildconstants.UpgradeBreezeHeight,

0 commit comments

Comments
 (0)