Skip to content

Commit e4bfac0

Browse files
author
Naohiro Yoshida
committed
add fork spec
Signed-off-by: Naohiro Yoshida <naohiro.yoshida@datachain.jp>
1 parent f079253 commit e4bfac0

File tree

8 files changed

+548
-88
lines changed

8 files changed

+548
-88
lines changed

module/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@ func (c *ProverConfig) Build(chain core.Chain) (core.Prover, error) {
1717
}
1818

1919
func (c *ProverConfig) Validate() error {
20+
if GetForkParameters(Network(c.Network)) == nil {
21+
return fmt.Errorf("unknown network: %s", c.Network)
22+
}
2023
return nil
2124
}

module/config.pb.go

Lines changed: 84 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

module/fork_spec.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package module
2+
3+
type Network string
4+
5+
const (
6+
Localnet Network = "localnet"
7+
Testnet Network = "testnet"
8+
Mainnet Network = "mainnet"
9+
)
10+
11+
// After Pascal HF only
12+
func GetForkParameters(network Network) []*ForkSpec {
13+
switch network {
14+
case Localnet:
15+
return []*ForkSpec{
16+
{
17+
HeightOrTimestamp: &ForkSpec_Timestamp{Timestamp: 0},
18+
AdditionalHeaderItemCount: 21,
19+
},
20+
}
21+
case Testnet:
22+
return []*ForkSpec{
23+
{
24+
HeightOrTimestamp: &ForkSpec_Timestamp{Timestamp: 1740452880},
25+
AdditionalHeaderItemCount: 21,
26+
},
27+
}
28+
case Mainnet:
29+
return []*ForkSpec{
30+
{
31+
//TODO
32+
HeightOrTimestamp: &ForkSpec_Timestamp{Timestamp: 0},
33+
AdditionalHeaderItemCount: 21,
34+
},
35+
}
36+
}
37+
return nil
38+
}

0 commit comments

Comments
 (0)