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

Astria named forks #59

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions consensus/misc/eip1559/eip1559.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Heade
// Verify that the gas limit remains within allowed bounds
parentGasLimit := parent.GasLimit
if !config.IsLondon(parent.Number) {
parentGasLimit = parent.GasLimit * config.ElasticityMultiplier(parent.Number.Uint64())
parentGasLimit = parent.GasLimit * config.GetAstriaForks().ElasticityMultiplierAt(parent.Number.Uint64())
}
if err := misc.VerifyGaslimit(parentGasLimit, header.GasLimit); err != nil {
return err
Expand All @@ -60,7 +60,7 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int {
return new(big.Int).SetUint64(params.InitialBaseFee)
}

parentGasTarget := parent.GasLimit / config.ElasticityMultiplier(parent.Number.Uint64()+1)
parentGasTarget := parent.GasLimit / config.GetAstriaForks().ElasticityMultiplierAt(parent.Number.Uint64()+1)
// If the parent gasUsed is the same as the target, the baseFee remains unchanged.
if parent.GasUsed == parentGasTarget {
return new(big.Int).Set(parent.BaseFee)
Expand All @@ -77,7 +77,7 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int {
num.SetUint64(parent.GasUsed - parentGasTarget)
num.Mul(num, parent.BaseFee)
num.Div(num, denom.SetUint64(parentGasTarget))
num.Div(num, denom.SetUint64(config.BaseFeeChangeDenominator(parent.Number.Uint64()+1)))
num.Div(num, denom.SetUint64(config.GetAstriaForks().BaseFeeChangeDenominatorAt(parent.Number.Uint64()+1)))
baseFeeDelta := math.BigMax(num, common.Big1)

return num.Add(parent.BaseFee, baseFeeDelta)
Expand All @@ -87,13 +87,10 @@ func CalcBaseFee(config *params.ChainConfig, parent *types.Header) *big.Int {
num.SetUint64(parentGasTarget - parent.GasUsed)
num.Mul(num, parent.BaseFee)
num.Div(num, denom.SetUint64(parentGasTarget))
num.Div(num, denom.SetUint64(config.BaseFeeChangeDenominator(parent.Number.Uint64()+1)))
num.Div(num, denom.SetUint64(config.GetAstriaForks().BaseFeeChangeDenominatorAt(parent.Number.Uint64()+1)))
baseFee := num.Sub(parent.BaseFee, num)

lowerBound := common.Big0
if config.AstriaEIP1559Params != nil {
lowerBound = config.AstriaEIP1559Params.MinBaseFeeAt(parent.Number.Uint64() + 1)
}
lowerBound := config.GetAstriaForks().MinBaseFeeAt(parent.Number.Uint64() + 1)

return math.BigMax(baseFee, lowerBound)
}
Expand Down
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
bc.currentBlock.Store(bc.genesisBlock.Header())
bc.currentFinalBlock.Store(bc.genesisBlock.Header())
bc.currentSafeBlock.Store(bc.genesisBlock.Header())
bc.currentBaseCelestiaHeight.Store(bc.Config().AstriaCelestiaInitialHeight)
bc.currentBaseCelestiaHeight.Store(bc.Config().GetAstriaForks().GetForkAtHeight(1).Celestia.StartHeight)

// Update chain info data metrics
chainInfoGauge.Update(metrics.GaugeInfoValue{"chain_id": bc.chainConfig.ChainID.String()})
Expand Down
4 changes: 2 additions & 2 deletions core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (b *BlockGen) AddUncle(h *types.Header) {
if b.cm.config.IsLondon(h.Number) {
h.BaseFee = eip1559.CalcBaseFee(b.cm.config, parent)
if !b.cm.config.IsLondon(parent.Number) {
parentGasLimit := parent.GasLimit * b.cm.config.ElasticityMultiplier(parent.Number.Uint64())
parentGasLimit := parent.GasLimit * b.cm.config.GetAstriaForks().ElasticityMultiplierAt(parent.Number.Uint64())
h.GasLimit = CalcGasLimit(parentGasLimit, parentGasLimit)
}
}
Expand Down Expand Up @@ -540,7 +540,7 @@ func (cm *chainMaker) makeHeader(parent *types.Block, state *state.StateDB, engi
if cm.config.IsLondon(header.Number) {
header.BaseFee = eip1559.CalcBaseFee(cm.config, parent.Header())
if !cm.config.IsLondon(parent.Number()) {
parentGasLimit := parent.GasLimit() * cm.config.ElasticityMultiplier(parent.Number().Uint64())
parentGasLimit := parent.GasLimit() * cm.config.GetAstriaForks().ElasticityMultiplierAt(parent.Number().Uint64())
header.GasLimit = CalcGasLimit(parentGasLimit, parentGasLimit)
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ func (g *Genesis) ToBlock() *types.Block {

extraData := g.ExtraData
if g.Config.AstriaOverrideGenesisExtraData {
extraData = g.Config.AstriaExtraData()
extraData = g.Config.AstriaExtraData(1)
}

head := &types.Header{
Expand Down
27 changes: 16 additions & 11 deletions dev/geth-genesis-local.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,22 @@
"ethash": {},
"astriaRollupName": "astria-test-chain-1",
"astriaOverrideGenesisExtraData": true,
"astriaSequencerInitialHeight": 2,
"astriaSequencerAddressPrefix": "astria",
"astriaCelestiaInitialHeight": 2,
"astriaCelestiaHeightVariance": 10,
"astriaBridgeAddresses": [],
"astriaBridgeSenderAddress": "0x0000000000000000000000000000000000000000",
"astriaFeeCollectors": {
"1": "0xaC21B97d35Bf75A7dAb16f35b111a50e78A72F30"
},
"astriaEIP1559Params": {
"1": { "minBaseFee": 0, "elasticityMultiplier": 2, "BaseFeeChangeDenominator": 8 }
"astriaForks": {
"testLaunch": {
"height": 1,
"feeCollector": "0xaC21B97d35Bf75A7dAb16f35b111a50e78A72F30",
"eip1559Params": { "minBaseFee": 0, "elasticityMultiplier": 2, "BaseFeeChangeDenominator": 8 },
"sequencer": {
"chainId": "sequencer-test-chain-0",
Copy link
Contributor

Choose a reason for hiding this comment

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

is this just used for genesis validation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is a justfile in the dev directory too which is used in our tutorials on running a local rollup. These are the default values needed if you follow the tutorial.

"addressPrefix": "astria",
"startHeight": 2
},
"celestia": {
"chainId": "mocha-4",
"startHeight": 2,
"heightVariance": 10
}
}
}
},
"difficulty": "10000000",
Expand Down
1 change: 0 additions & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
}

eth.miner = miner.New(eth, config.Miner, eth.engine)
eth.miner.SetExtra(chainConfig.AstriaExtraData())

eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil}
if eth.APIBackend.allowUnprotectedTxs {
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/ethereum/go-ethereum
go 1.21

require (
buf.build/gen/go/astria/execution-apis/grpc/go v1.5.1-20241017141511-7e4bcc0ebba5.1
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.35.1-20241017141511-7e4bcc0ebba5.1
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.35.1-20240911152449-eeebd3decdce.1
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.35.1-20241017141511-71aab1871615.1
buf.build/gen/go/astria/execution-apis/grpc/go v1.5.1-00000000000000-d9b5ae55864c.2
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.36.2-00000000000000-d9b5ae55864c.1
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.36.2-00000000000000-d95ace43ccf0.1
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.36.2-00000000000000-9be5ad1ca3f1.1
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0
github.com/Microsoft/go-winio v0.6.1
github.com/VictoriaMetrics/fastcache v1.12.1
Expand Down Expand Up @@ -79,7 +79,7 @@ require (
golang.org/x/time v0.5.0
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.35.1
google.golang.org/protobuf v1.36.2
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/yaml.v3 v3.0.1
)
Expand Down
38 changes: 28 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
buf.build/gen/go/astria/execution-apis/grpc/go v1.5.1-20241017141511-7e4bcc0ebba5.1 h1:v7QnrDjNmG7I/0aqZdtlP3cBPQGd62w4AYVF8TfAcHM=
buf.build/gen/go/astria/execution-apis/grpc/go v1.5.1-20241017141511-7e4bcc0ebba5.1/go.mod h1:T5EsLvEE5UMk62gVSwNY/7XlxknAP3sL8tYRsU68b4s=
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.35.1-20241017141511-7e4bcc0ebba5.1 h1:3G2O21DuY5Y/G32tP1mAI16AxwDYTscG2YaOb/WQty0=
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.35.1-20241017141511-7e4bcc0ebba5.1/go.mod h1:U4LUlabiYNYBd1pqYS9o8SsHjBRoEBysrfRVnebzJH0=
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.35.1-20240911152449-eeebd3decdce.1 h1:kG4riHqlF9X6iZ1Oxs5/6ul6aue7MS+A6DK6HAchuTk=
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.35.1-20240911152449-eeebd3decdce.1/go.mod h1:n9L7X3VAj4od4VHf2ScJuHARUUQTSxJqtRHZk/7Ptt0=
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.35.1-20241017141511-71aab1871615.1 h1:hPMoxTiT7jJjnIbWqneBbL05VeVOTD9UeC/qdvzHL8g=
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.35.1-20241017141511-71aab1871615.1/go.mod h1:2uasRFMH+a3DaF34c1o+w7/YtYnoknmARyYpb9W2QIc=
buf.build/gen/go/astria/execution-apis/grpc/go v1.5.1-00000000000000-39902173feaa.1 h1:uaDI8dZs+IE3KDmZaXME5Tr81uQ6jBb64uNVYeHJ2r8=
buf.build/gen/go/astria/execution-apis/grpc/go v1.5.1-00000000000000-39902173feaa.1/go.mod h1:6bUdMcnGoOiSPYZ+7Cwz24xU9zUrvLlfIifHAzUudnY=
buf.build/gen/go/astria/execution-apis/grpc/go v1.5.1-00000000000000-d9b5ae55864c.2 h1:q+20sqaEUPt3R/KOWjM1KrmfFtMtCJN3grbRX/b9ySQ=
buf.build/gen/go/astria/execution-apis/grpc/go v1.5.1-00000000000000-d9b5ae55864c.2/go.mod h1:xZRJPCBZP0R0gl3kg44oW5bGWG8pHrrGLtA8B6LsOOc=
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.35.2-00000000000000-39902173feaa.1 h1:27BBCnfzO1X5HMhHpQ0TNr/FZuUE3OvfG/B3g0e6+5s=
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.35.2-00000000000000-39902173feaa.1/go.mod h1:PDytSMSvh3RzdjqGE/abPqSxFTZtahXu2rmM+9PQhvY=
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.36.1-00000000000000-d9b5ae55864c.1 h1:IFOlTF2lzUE0IzJfM/Zrm7CIKfVcV5JU0w6f2oGLTfg=
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.36.1-00000000000000-d9b5ae55864c.1/go.mod h1:iaB9+a1Tvk6iiD3NzlXI8GFLs0AqAVNRL2n8vTHkdLY=
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.36.2-00000000000000-d9b5ae55864c.1 h1:mo8BZoepJW2FrrwuJZxVq7JXHZ7IeHeF3xIcEjCQ9lc=
buf.build/gen/go/astria/execution-apis/protocolbuffers/go v1.36.2-00000000000000-d9b5ae55864c.1/go.mod h1:rWf3Lvbpv9nzynfUQASrpbDydoRzyT/bm0nIFMhMkPc=
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.35.2-00000000000000-d95ace43ccf0.1 h1:NtZp7kyoPm4vxioQPvaPfXNoQUAzRCOKnTfaj/fgBAQ=
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.35.2-00000000000000-d95ace43ccf0.1/go.mod h1:I9FcB1oNqT1nI+ny0GD8gF9YrIYrHmczgNu6MTE9fAo=
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.36.1-00000000000000-d95ace43ccf0.1 h1:MjGboR15UjIZBUXofmCMnerkyeBGTOOiNwJPHPfOyqU=
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.36.1-00000000000000-d95ace43ccf0.1/go.mod h1:HnX2FkSKZuD3zPFBR+Q17WzloqvIbFd0pYE++or/x2Q=
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.36.2-00000000000000-d95ace43ccf0.1 h1:xNuYV8H8GbUpcMM7S2iGwjg7HswyE/2YrsbLybxLto4=
buf.build/gen/go/astria/primitives/protocolbuffers/go v1.36.2-00000000000000-d95ace43ccf0.1/go.mod h1:Lk1TBSGhOGvbtj0lb7eTeq+Z4N86/67Ay+WWxbqhh6s=
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.35.2-00000000000000-9be5ad1ca3f1.1 h1:d3Cu4wQ6dAf2P+8gSsClUdWe+waNXrHCO02EJrJruFk=
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.35.2-00000000000000-9be5ad1ca3f1.1/go.mod h1:oyKOX3YjAN6T+jYc5Rai+RgrZD9b+sDXpdTSAgIISUA=
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.36.1-00000000000000-9be5ad1ca3f1.1 h1:cWlFRWGhQ1+xdF9F4Z1mmRGFY0xZpudLWBy5KrHhKiY=
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.36.1-00000000000000-9be5ad1ca3f1.1/go.mod h1:CVq79u6hTk0buR3M2g3Yg/rLRN6MMxTf9Nn5JWUIeFc=
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.36.2-00000000000000-9be5ad1ca3f1.1 h1:Cd/jFk9rohdB1ckA30caRjQleFC8J67fNXgtyWkQadI=
buf.build/gen/go/astria/sequencerblock-apis/protocolbuffers/go v1.36.2-00000000000000-9be5ad1ca3f1.1/go.mod h1:JUPGxE+f8MD5sDPN1B9IZxqa8uD+gc1D6qaj+D7dHuU=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
Expand Down Expand Up @@ -895,8 +909,12 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU=
google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
Loading
Loading