Skip to content

Commit f318ae0

Browse files
Merge branch 'master' into make-filterlogsfunction-public
2 parents 4d76989 + fe26733 commit f318ae0

10 files changed

+66
-19
lines changed

core/genesis.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ type Genesis struct {
7373
BaseFee *big.Int `json:"baseFeePerGas"` // EIP-1559
7474
ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844
7575
BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844
76+
77+
// Arbitrum
78+
ArbOSInit *params.ArbOSInit `json:"arbOSInit,omitempty"`
7679
}
7780

7881
// copy copies the genesis.

core/state/statedb.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,13 @@ func (s *StateDB) ExpectBalanceBurn(amount *big.Int) {
479479
s.arbExtraData.unexpectedBalanceDelta.Add(s.arbExtraData.unexpectedBalanceDelta, amount)
480480
}
481481

482+
func (s *StateDB) ExpectBalanceMint(amount *big.Int) {
483+
if amount.Sign() < 0 {
484+
panic(fmt.Sprintf("ExpectBalanceMint called with negative amount %v", amount))
485+
}
486+
s.arbExtraData.unexpectedBalanceDelta.Sub(s.arbExtraData.unexpectedBalanceDelta, amount)
487+
}
488+
482489
func (s *StateDB) SetNonce(addr common.Address, nonce uint64, reason tracing.NonceChangeReason) {
483490
stateObject := s.getOrNewStateObject(addr)
484491
if stateObject != nil {

core/state/statedb_hooked.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ func (s *hookedStateDB) ExpectBalanceBurn(b *big.Int) {
362362
s.inner.ExpectBalanceBurn(b)
363363
}
364364

365+
func (s *hookedStateDB) ExpectBalanceMint(b *big.Int) {
366+
s.inner.ExpectBalanceMint(b)
367+
}
368+
365369
func (s *hookedStateDB) GetSelfDestructs() []common.Address {
366370
return s.inner.GetSelfDestructs()
367371
}

core/tracing/gen_balance_change_reason_stringer.go

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

core/tracing/hooks.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ const (
307307
// Stylus
308308
BalanceChangeTransferActivationFee
309309
BalanceChangeTransferActivationReimburse
310+
// Native token minting and burning
311+
BalanceIncreaseMintNativeToken
312+
BalanceDecreaseBurnNativeToken
310313
)
311314

312315
// Str gives the arbitrum specific string for the corresponding BalanceChangeReason

core/types/arbitrum_signer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var ArbStatisticsAddress = common.HexToAddress("0x6f")
2222
var ArbOwnerAddress = common.HexToAddress("0x70")
2323
var ArbWasmAddress = common.HexToAddress("0x71")
2424
var ArbWasmCacheAddress = common.HexToAddress("0x72")
25+
var ArbNativeTokenManagerAddress = common.HexToAddress("0x73")
2526
var NodeInterfaceAddress = common.HexToAddress("0xc8")
2627
var NodeInterfaceDebugAddress = common.HexToAddress("0xc9")
2728
var ArbDebugAddress = common.HexToAddress("0xff")

core/vm/interface.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ type StateDB interface {
6666
AddBalance(common.Address, *uint256.Int, tracing.BalanceChangeReason) uint256.Int
6767
GetBalance(common.Address) *uint256.Int
6868
ExpectBalanceBurn(*big.Int)
69+
ExpectBalanceMint(*big.Int)
6970

7071
GetNonce(common.Address) uint64
7172
SetNonce(common.Address, uint64, tracing.NonceChangeReason)

internal/ethapi/transaction_args.go

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend, head
194194
if args.BlobFeeCap != nil && args.BlobFeeCap.ToInt().Sign() == 0 {
195195
return errors.New("maxFeePerBlobGas, if specified, must be non-zero")
196196
}
197+
if b.ChainConfig().IsCancun(head.Number, head.Time, types.DeserializeHeaderExtraInformation(head).ArbOSFormatVersion) {
198+
args.setCancunFeeDefaults(b.ChainConfig(), head)
199+
}
197200
// If both gasPrice and at least one of the EIP-1559 fee parameters are specified, error.
198201
if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) {
199202
return errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
@@ -211,10 +214,7 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend, head
211214
if args.MaxFeePerGas.ToInt().Cmp(args.MaxPriorityFeePerGas.ToInt()) < 0 {
212215
return fmt.Errorf("maxFeePerGas (%v) < maxPriorityFeePerGas (%v)", args.MaxFeePerGas, args.MaxPriorityFeePerGas)
213216
}
214-
// No need to set anything other than CancunFeeDefaults, user already set MaxFeePerGas and MaxPriorityFeePerGas
215-
if err := args.setCancunFeeDefaults(ctx, b.ChainConfig(), head, b); err != nil {
216-
return err
217-
}
217+
return nil // No need to set anything, user already set MaxFeePerGas and MaxPriorityFeePerGas
218218
}
219219

220220
// Sanity check the non-EIP-1559 fee parameters.
@@ -228,14 +228,7 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend, head
228228
}
229229

230230
// Now attempt to fill in default value depending on whether London is active or not.
231-
if b.ChainConfig().IsCancun(head.Number, head.Time, types.DeserializeHeaderExtraInformation(head).ArbOSFormatVersion) {
232-
if err := args.setCancunFeeDefaults(ctx, b.ChainConfig(), head, b); err != nil {
233-
return err
234-
}
235-
} else if isLondon {
236-
if args.BlobFeeCap != nil {
237-
return errors.New("maxFeePerBlobGas is not valid before Cancun is active")
238-
}
231+
if isLondon {
239232
// London is active, set maxPriorityFeePerGas and maxFeePerGas.
240233
if err := args.setLondonFeeDefaults(ctx, head, b); err != nil {
241234
return err
@@ -255,7 +248,7 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend, head
255248
}
256249

257250
// setCancunFeeDefaults fills in reasonable default fee values for unspecified fields.
258-
func (args *TransactionArgs) setCancunFeeDefaults(ctx context.Context, config *params.ChainConfig, head *types.Header, b Backend) error {
251+
func (args *TransactionArgs) setCancunFeeDefaults(config *params.ChainConfig, head *types.Header) {
259252
// Set maxFeePerBlobGas if it is missing.
260253
if args.BlobHashes != nil && args.BlobFeeCap == nil {
261254
blobBaseFee := eip4844.CalcBlobFee(config, head)
@@ -265,7 +258,6 @@ func (args *TransactionArgs) setCancunFeeDefaults(ctx context.Context, config *p
265258
val := new(big.Int).Mul(blobBaseFee, big.NewInt(2))
266259
args.BlobFeeCap = (*hexutil.Big)(val)
267260
}
268-
return args.setLondonFeeDefaults(ctx, head, b)
269261
}
270262

271263
// setLondonFeeDefaults fills in reasonable default fee values for unspecified fields.

params/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ var NetworkNames = map[string]string{
344344
HoleskyChainConfig.ChainID.String(): "holesky",
345345
}
346346

347+
// Arbitrum
348+
// ArbOSInit defines some initialization values for ArbOS state.
349+
type ArbOSInit struct {
350+
NativeTokenSupplyManagementEnabled bool `json:"nativeTokenSupplyManagementEnabled"`
351+
}
352+
347353
// ChainConfig is the core config which determines the blockchain settings.
348354
//
349355
// ChainConfig is stored in the database on a per block basis. This means

params/config_arbitrum.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ const ArbosVersion_30 = uint64(30)
3737
const ArbosVersion_31 = uint64(31)
3838
const ArbosVersion_32 = uint64(32)
3939
const ArbosVersion_40 = uint64(40)
40+
const ArbosVersion_41 = uint64(41)
4041

4142
const ArbosVersion_FixRedeemGas = ArbosVersion_11
4243
const ArbosVersion_Stylus = ArbosVersion_30
4344
const ArbosVersion_StylusFixes = ArbosVersion_31
4445
const ArbosVersion_StylusChargingFixes = ArbosVersion_32
4546
const MaxArbosVersionSupported = ArbosVersion_40
46-
const MaxDebugArbosVersionSupported = ArbosVersion_40
47+
const MaxDebugArbosVersionSupported = ArbosVersion_41
4748

4849
type ArbitrumChainParams struct {
4950
EnableArbOS bool

0 commit comments

Comments
 (0)