diff --git a/ethapi/api.go b/ethapi/api.go
index b4ecbc0d2..cca521607 100644
--- a/ethapi/api.go
+++ b/ethapi/api.go
@@ -994,7 +994,7 @@ func (diff *StateOverride) Apply(state state.StateDB) error {
}
// Override account(contract) code.
if account.Code != nil {
- state.SetCode(addr, *account.Code)
+ state.SetCode(addr, *account.Code, tracing.CodeChangeUnspecified)
}
// Override account balance.
if account.Balance != nil {
diff --git a/ethapi/api_test.go b/ethapi/api_test.go
index 655b54a5f..c3e1ae5fe 100644
--- a/ethapi/api_test.go
+++ b/ethapi/api_test.go
@@ -556,7 +556,7 @@ func runEstimateGasOverrideTest(t *testing.T, test stateOverrideEstimateGasTest)
mockBackend.EXPECT().GetPoolNonce(any, any).Return(uint64(0), nil).AnyTimes()
mockState.EXPECT().GetBalance(any).Return(uint256.NewInt(12345678901234567890)).AnyTimes()
- mockState.EXPECT().SetCode(any, any).AnyTimes()
+ mockState.EXPECT().SetCode(any, any, any).AnyTimes()
mockState.EXPECT().SetBalance(any, any).AnyTimes()
mockState.EXPECT().SetStorage(any, any).AnyTimes()
mockState.EXPECT().SetState(any, any, any).AnyTimes()
@@ -1299,10 +1299,22 @@ func (fcc *FakeChainContext) Engine() consensus.Engine {
return nil
}
+func (fcc *FakeChainContext) CurrentHeader() *types.Header {
+ return fcc.header
+}
+
func (fcc *FakeChainContext) GetHeader(common.Hash, uint64) *types.Header {
return fcc.header
}
+func (fcc *FakeChainContext) GetHeaderByNumber(uint64) *types.Header {
+ return fcc.header
+}
+
+func (fcc *FakeChainContext) GetHeaderByHash(common.Hash) *types.Header {
+ return fcc.header
+}
+
func (fcc *FakeChainContext) Config() *params.ChainConfig {
return fcc.chainConfig
}
diff --git a/ethapi/transaction_args.go b/ethapi/transaction_args.go
index 8cfc9a697..15710764c 100644
--- a/ethapi/transaction_args.go
+++ b/ethapi/transaction_args.go
@@ -285,7 +285,7 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, lo
BlobHashes: args.BlobHashes,
SetCodeAuthorizations: args.AuthorizationList,
SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipTransactionChecks: true,
}, nil
}
diff --git a/ethapi/transaction_args_test.go b/ethapi/transaction_args_test.go
index 0b49d2315..ef00213b1 100644
--- a/ethapi/transaction_args_test.go
+++ b/ethapi/transaction_args_test.go
@@ -209,8 +209,8 @@ func TestTransactionArgs_ToMessage_TrivialFieldsAreCopied(t *testing.T) {
},
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
}, *msg)
}
@@ -233,8 +233,8 @@ func TestTransactionArgs_ToMessage_GasPriceFollowsEIP1559Rules(t *testing.T) {
GasTipCap: big.NewInt(0),
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
},
},
"zero initialized and basefee uses eip1559 rules": {
@@ -248,8 +248,8 @@ func TestTransactionArgs_ToMessage_GasPriceFollowsEIP1559Rules(t *testing.T) {
GasTipCap: big.NewInt(0),
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
},
baseFee: big.NewInt(77),
},
@@ -265,8 +265,8 @@ func TestTransactionArgs_ToMessage_GasPriceFollowsEIP1559Rules(t *testing.T) {
GasFeeCap: big.NewInt(10000000),
GasTipCap: big.NewInt(10000000),
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
},
baseFee: big.NewInt(77),
},
@@ -282,8 +282,8 @@ func TestTransactionArgs_ToMessage_GasPriceFollowsEIP1559Rules(t *testing.T) {
GasFeeCap: big.NewInt(10000000),
GasTipCap: big.NewInt(10000000),
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
},
},
"maxFeePerGas and no basefee uses pre-eip1559 rules": {
@@ -299,8 +299,8 @@ func TestTransactionArgs_ToMessage_GasPriceFollowsEIP1559Rules(t *testing.T) {
GasTipCap: big.NewInt(0),
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
},
},
"maxFeePerGas and basefee uses eip1559 rules": {
@@ -316,8 +316,8 @@ func TestTransactionArgs_ToMessage_GasPriceFollowsEIP1559Rules(t *testing.T) {
GasTipCap: big.NewInt(0),
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
},
baseFee: big.NewInt(77),
},
@@ -334,8 +334,8 @@ func TestTransactionArgs_ToMessage_GasPriceFollowsEIP1559Rules(t *testing.T) {
GasTipCap: big.NewInt(0),
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
},
},
"maxPriorityFeePerGas and basefee uses eip1559 rules": {
@@ -351,8 +351,8 @@ func TestTransactionArgs_ToMessage_GasPriceFollowsEIP1559Rules(t *testing.T) {
GasTipCap: big.NewInt(1234),
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
},
baseFee: big.NewInt(77),
},
@@ -370,8 +370,8 @@ func TestTransactionArgs_ToMessage_GasPriceFollowsEIP1559Rules(t *testing.T) {
GasTipCap: big.NewInt(0),
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
},
},
"maxFeePerGas, maxPriorityFeePerGas and basefee uses eip1559 rules": {
@@ -388,8 +388,8 @@ func TestTransactionArgs_ToMessage_GasPriceFollowsEIP1559Rules(t *testing.T) {
GasTipCap: big.NewInt(5678),
// Hardcoded values
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
},
baseFee: big.NewInt(77),
},
diff --git a/evmcore/state_processor.go b/evmcore/state_processor.go
index a620380bc..c0f798efa 100644
--- a/evmcore/state_processor.go
+++ b/evmcore/state_processor.go
@@ -575,20 +575,20 @@ func TxAsMessage(tx *types.Transaction, signer types.Signer, baseFee *big.Int) (
return core.TransactionToMessage(tx, signer, baseFee)
} else {
return &core.Message{ // internal tx - no signature checking
- From: internaltx.InternalSender(tx),
- To: tx.To(),
- Nonce: tx.Nonce(),
- Value: tx.Value(),
- GasLimit: tx.Gas(),
- GasPrice: tx.GasPrice(),
- GasFeeCap: tx.GasFeeCap(),
- GasTipCap: tx.GasTipCap(),
- Data: tx.Data(),
- AccessList: tx.AccessList(),
- BlobGasFeeCap: tx.BlobGasFeeCap(),
- BlobHashes: tx.BlobHashes(),
- SkipNonceChecks: true, // don't check sender nonce and being EOA
- SkipFromEOACheck: true,
+ From: internaltx.InternalSender(tx),
+ To: tx.To(),
+ Nonce: tx.Nonce(),
+ Value: tx.Value(),
+ GasLimit: tx.Gas(),
+ GasPrice: tx.GasPrice(),
+ GasFeeCap: tx.GasFeeCap(),
+ GasTipCap: tx.GasTipCap(),
+ Data: tx.Data(),
+ AccessList: tx.AccessList(),
+ BlobGasFeeCap: tx.BlobGasFeeCap(),
+ BlobHashes: tx.BlobHashes(),
+ SkipNonceChecks: true, // don't check sender nonce and being EOA
+ SkipTransactionChecks: true,
}, nil
}
}
diff --git a/evmcore/state_processor_test.go b/evmcore/state_processor_test.go
index 2a7d30f34..8d8c7c7ae 100644
--- a/evmcore/state_processor_test.go
+++ b/evmcore/state_processor_test.go
@@ -469,10 +469,10 @@ func TestApplyTransaction_InternalTransactionsSkipBaseFeeCharges(t *testing.T) {
// this is not relevant. We just want to check if the base fee
// configuration flag is updated to match the SkipAccountChecks flag.
_, _, err := applyTransaction(&core.Message{
- SkipNonceChecks: internal,
- SkipFromEOACheck: internal,
- GasPrice: big.NewInt(0),
- Value: big.NewInt(0),
+ SkipNonceChecks: internal,
+ SkipTransactionChecks: internal,
+ GasPrice: big.NewInt(0),
+ Value: big.NewInt(0),
}, gp, state, nil, nil, nil, evm, nil)
if err == nil {
t.Errorf("expected transaction to fail")
@@ -541,16 +541,16 @@ func TestApplyTransaction_ApplyMessageError_RevertsSnapshotIfPrague(t *testing.T
initCode := make([]byte, 50000) // large init code to trigger error
msg := &core.Message{
- From: common.Address{1},
- To: nil, // contract creation
- GasLimit: 1000000,
- GasPrice: big.NewInt(1),
- GasFeeCap: big.NewInt(0),
- GasTipCap: big.NewInt(0),
- Value: big.NewInt(0),
- Data: initCode,
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
+ From: common.Address{1},
+ To: nil, // contract creation
+ GasLimit: 1000000,
+ GasPrice: big.NewInt(1),
+ GasFeeCap: big.NewInt(0),
+ GasTipCap: big.NewInt(0),
+ Value: big.NewInt(0),
+ Data: initCode,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
}
gomock.InOrder(
diff --git a/evmcore/tx_list.go b/evmcore/tx_list.go
index 484dedd51..343ec0326 100644
--- a/evmcore/tx_list.go
+++ b/evmcore/tx_list.go
@@ -24,6 +24,7 @@ import (
"time"
"github.com/0xsoniclabs/sonic/gossip/blockproc/subsidies"
+ "github.com/0xsoniclabs/sonic/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
)
@@ -485,7 +486,7 @@ func (h *priceHeap) Less(i, j int) bool {
func (h *priceHeap) cmp(a, b *types.Transaction) int {
if h.baseFee != nil {
// Compare effective tips if baseFee is specified
- if c := a.EffectiveGasTipCmp(b, h.baseFee); c != 0 {
+ if c := a.EffectiveGasTipCmp(b, utils.BigIntToUint256Clamped(h.baseFee)); c != 0 {
return c
}
}
diff --git a/evmcore/tx_pool.go b/evmcore/tx_pool.go
index 97b47e299..094252c40 100644
--- a/evmcore/tx_pool.go
+++ b/evmcore/tx_pool.go
@@ -601,13 +601,15 @@ func (pool *TxPool) Pending(enforceTips bool) (map[common.Address]types.Transact
defer pool.mu.Unlock()
pending := make(map[common.Address]types.Transactions)
+ minTip := utils.BigIntToUint256Clamped(pool.minTip)
+ baseFee := utils.BigIntToUint256Clamped(pool.priced.urgent.baseFee)
for addr, list := range pool.pending {
txs := list.Flatten()
// If the miner requests tip enforcement, cap the lists now
if enforceTips && !pool.locals.contains(addr) {
for i, tx := range txs {
- if tx.EffectiveGasTipIntCmp(pool.minTip, pool.priced.urgent.baseFee) < 0 && !subsidies.IsSponsorshipRequest(tx) {
+ if tx.EffectiveGasTipIntCmp(minTip, baseFee) < 0 && !subsidies.IsSponsorshipRequest(tx) {
txs = txs[:i]
break
}
diff --git a/evmcore/tx_pool_test.go b/evmcore/tx_pool_test.go
index fd68a4a5f..d280c6d6a 100644
--- a/evmcore/tx_pool_test.go
+++ b/evmcore/tx_pool_test.go
@@ -34,6 +34,7 @@ import (
"github.com/0xsoniclabs/sonic/utils"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
@@ -118,7 +119,7 @@ func (t testTxPoolStateDb) GetCodeHash(addr common.Address) common.Hash {
return hash
}
-func (t testTxPoolStateDb) SetCode(addr common.Address, code []byte) []byte {
+func (t testTxPoolStateDb) SetCode(addr common.Address, code []byte, _ tracing.CodeChangeReason) []byte {
if len(code) == 0 {
delete(t.codeHashes, addr)
} else {
@@ -652,8 +653,8 @@ func TestSetCodeTransactions(t *testing.T) {
pending: 1,
test: func(t *testing.T, pool *TxPool) {
aa := common.Address{0xaa, 0xaa}
- db.SetCode(addrA, append(types.DelegationPrefix, aa.Bytes()...))
- db.SetCode(aa, []byte{byte(vm.ADDRESS), byte(vm.PUSH0), byte(vm.SSTORE)})
+ db.SetCode(addrA, append(types.DelegationPrefix, aa.Bytes()...), tracing.CodeChangeUnspecified)
+ db.SetCode(aa, []byte{byte(vm.ADDRESS), byte(vm.PUSH0), byte(vm.SSTORE)}, tracing.CodeChangeUnspecified)
// Send gapped transaction, it should be rejected.
if err := pool.addRemoteSync(pricedTransaction(2, 100000, big.NewInt(1), keyA)); !errors.Is(err, ErrOutOfOrderTxFromDelegated) {
@@ -677,7 +678,7 @@ func TestSetCodeTransactions(t *testing.T) {
}
// Reset the delegation, avoid leaking state into the other tests
- db.SetCode(addrA, nil)
+ db.SetCode(addrA, nil, tracing.CodeChangeUnspecified)
},
},
"only one transaction from delegating account in flight": {
diff --git a/evmcore/tx_validation_fuzzer_test.go b/evmcore/tx_validation_fuzzer_test.go
index 9b7057344..8c5b6d836 100644
--- a/evmcore/tx_validation_fuzzer_test.go
+++ b/evmcore/tx_validation_fuzzer_test.go
@@ -419,7 +419,7 @@ func stateExpectCalls(state *state.MockStateDB) {
state.EXPECT().AddLog(any).AnyTimes()
state.EXPECT().AddRefund(any).AnyTimes()
- state.EXPECT().SetCode(any, any).Return([]byte{}).AnyTimes()
+ state.EXPECT().SetCode(any, any, any).Return([]byte{}).AnyTimes()
state.EXPECT().SetNonce(any, any, any).AnyTimes()
state.EXPECT().SetState(any, any, any).Return(common.Hash{}).AnyTimes()
diff --git a/go.mod b/go.mod
index 551c8f1c1..d8d1126fd 100644
--- a/go.mod
+++ b/go.mod
@@ -20,14 +20,14 @@ go 1.24.0
require (
github.com/0xsoniclabs/carmen/go v0.0.0-20251014092906-75df60dc78cb
- github.com/0xsoniclabs/tosca v0.0.0-20250905062239-b2db1e70e826
+ github.com/0xsoniclabs/tosca v0.0.0-20251023131117-f542dea83f5b
github.com/Fantom-foundation/lachesis-base v0.0.0-20240116072301-a75735c4ef00
github.com/cespare/cp v1.1.1
github.com/consensys/gnark-crypto v0.18.0
github.com/davecgh/go-spew v1.1.1
github.com/deckarep/golang-set v1.8.0
github.com/docker/docker v27.3.1+incompatible
- github.com/ethereum/go-ethereum v1.16.1
+ github.com/ethereum/go-ethereum v1.16.5
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08
github.com/hashicorp/golang-lru v1.0.2
github.com/holiman/uint256 v1.3.2
@@ -38,12 +38,12 @@ require (
github.com/pkg/errors v0.9.1
github.com/status-im/keycard-go v0.3.2
github.com/stretchr/testify v1.10.0
- github.com/supranational/blst v0.3.14
+ github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tyler-smith/go-bip39 v1.1.0
go.uber.org/mock v0.4.0
golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d
- golang.org/x/sys v0.31.0
+ golang.org/x/sys v0.36.0
google.golang.org/protobuf v1.34.2
gopkg.in/urfave/cli.v1 v1.20.0
)
@@ -51,7 +51,7 @@ require (
require (
github.com/DataDog/zstd v1.5.6 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
- github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
+ github.com/VictoriaMetrics/fastcache v1.13.0 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
@@ -64,7 +64,7 @@ require (
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
- github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect
+ github.com/crate-crypto/go-eth-kzg v1.4.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
@@ -72,7 +72,8 @@ require (
github.com/dop251/goja v0.0.0-20240919115326-6c7d1df7ff05 // indirect
github.com/emicklei/dot v1.6.2 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
- github.com/ethereum/c-kzg-4844/v2 v2.1.0 // indirect
+ github.com/ethereum/c-kzg-4844/v2 v2.1.3 // indirect
+ github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab // indirect
github.com/ethereum/go-verkle v0.2.2 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/ferranbt/fastssz v0.1.4 // indirect
@@ -83,13 +84,12 @@ require (
github.com/gofrs/flock v0.12.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
- github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
+ github.com/golang/snappy v1.0.0 // indirect
github.com/google/pprof v0.0.0-20240910150728-a0b0bb1d4134 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/hashicorp/go-bexpr v0.1.14 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
- github.com/holiman/billy v0.0.0-20240322075458-72a4e81ec6da // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/influxdata/influxdb-client-go/v2 v2.14.0 // indirect
@@ -143,6 +143,6 @@ require (
pgregory.net/rand v1.0.2 // indirect
)
-replace github.com/ethereum/go-ethereum => github.com/0xsoniclabs/go-ethereum v0.0.0-20250827114033-a49cee8740d2
+replace github.com/ethereum/go-ethereum => github.com/0xsoniclabs/go-ethereum v0.0.0-20251022155730-949ae6d396a5
replace github.com/Fantom-foundation/lachesis-base => github.com/Fantom-foundation/lachesis-base-sonic v0.0.0-20250701061954-44075d09185c
diff --git a/go.sum b/go.sum
index c8f23b1ef..c0eecd56d 100644
--- a/go.sum
+++ b/go.sum
@@ -1,9 +1,9 @@
github.com/0xsoniclabs/carmen/go v0.0.0-20251014092906-75df60dc78cb h1:5fhxc/Ztq3f1+h7iBjxTyVA7qsLKVeXA1NedtBqWnD0=
github.com/0xsoniclabs/carmen/go v0.0.0-20251014092906-75df60dc78cb/go.mod h1:EyfPnCDA/2Q45D9icCSj4MDhbkWbpkUNLSNE7ThjbGM=
-github.com/0xsoniclabs/go-ethereum v0.0.0-20250827114033-a49cee8740d2 h1:OHaJBUO/R6SOHCDNMskfnakEz59bo1fl7Tmz73GCUnA=
-github.com/0xsoniclabs/go-ethereum v0.0.0-20250827114033-a49cee8740d2/go.mod h1:pm9P/VM1zE+1AQPGpoCEaA/0sbu7GFNex/nyjjPRcrU=
-github.com/0xsoniclabs/tosca v0.0.0-20250905062239-b2db1e70e826 h1:oTvp7bBOzh0H43tMfYuaak0naAMZvulAAXYakA3Yhh8=
-github.com/0xsoniclabs/tosca v0.0.0-20250905062239-b2db1e70e826/go.mod h1:HO+N0cPuqKXy77gCmHLPnRcD8VvLCdNi5N5wGZl+tuk=
+github.com/0xsoniclabs/go-ethereum v0.0.0-20251022155730-949ae6d396a5 h1:rNYy8OCRBKxRJNZO77zz1DPlkEgBX2BuN6tlI/qaqNU=
+github.com/0xsoniclabs/go-ethereum v0.0.0-20251022155730-949ae6d396a5/go.mod h1:DIzKEbqD4o6KXM9nTaELFXyScXzZPRblv+6L3X01ck4=
+github.com/0xsoniclabs/tosca v0.0.0-20251023131117-f542dea83f5b h1:j+esU091Czcyi0GVHboNNNoWLVSo1m42+9CT8KC602E=
+github.com/0xsoniclabs/tosca v0.0.0-20251023131117-f542dea83f5b/go.mod h1:W8rhG6ZVofBCjcxS5/kW4GLV1hbuwPiPwlfBmMWnoKY=
github.com/DataDog/zstd v1.5.6 h1:LbEglqepa/ipmmQJUDnSsfvA8e8IStVcGaFWDuxvGOY=
github.com/DataDog/zstd v1.5.6/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
github.com/Fantom-foundation/lachesis-base-sonic v0.0.0-20250701061954-44075d09185c h1:WpQufGBaH6jUqS+naqohiamg6PpckdtsLzSdEcCSkHs=
@@ -13,9 +13,8 @@ github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYr
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=
-github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI=
-github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI=
-github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
+github.com/VictoriaMetrics/fastcache v1.13.0 h1:AW4mheMR5Vd9FkAPUv+NH6Nhw+fmbTMGMsNAoA/+4G0=
+github.com/VictoriaMetrics/fastcache v1.13.0/go.mod h1:hHXhl4DA2fTL2HTZDJFXWgW0LNjo6B+4aj2Wmng3TjU=
github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc=
github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ=
@@ -27,7 +26,6 @@ github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6
github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w=
github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU=
github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
-github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4=
@@ -48,14 +46,16 @@ github.com/consensys/gnark-crypto v0.18.0 h1:vIye/FqI50VeAr0B3dx+YjeIvmc3LWz4yEf
github.com/consensys/gnark-crypto v0.18.0/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
-github.com/crate-crypto/go-eth-kzg v1.3.0 h1:05GrhASN9kDAidaFJOda6A4BEvgvuXbazXg/0E3OOdI=
-github.com/crate-crypto/go-eth-kzg v1.3.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn6ahQWEuiLHOjCUI=
+github.com/crate-crypto/go-eth-kzg v1.4.0 h1:WzDGjHk4gFg6YzV0rJOAsTK4z3Qkz5jd4RE3DAvPFkg=
+github.com/crate-crypto/go-eth-kzg v1.4.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn6ahQWEuiLHOjCUI=
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg=
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwzHBvIzm2RfVCGNEBZgRyjwK40bVoun3ZnGOCafNM=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dchest/siphash v1.2.3 h1:QXwFc8cFOR2dSa/gE6o/HokBMWtLUaNDVd+22aKHeEA=
+github.com/dchest/siphash v1.2.3/go.mod h1:0NvQU092bT0ipiFN++/rXm69QG9tVxLAlQHIXMPAkHc=
github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4=
github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo=
github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM=
@@ -74,10 +74,12 @@ github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A=
github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s=
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
-github.com/ethereum/c-kzg-4844/v2 v2.1.0 h1:gQropX9YFBhl3g4HYhwE70zq3IHFRgbbNPw0Shwzf5w=
-github.com/ethereum/c-kzg-4844/v2 v2.1.0/go.mod h1:TC48kOKjJKPbN7C++qIgt0TJzZ70QznYR7Ob+WXl57E=
+github.com/ethereum/c-kzg-4844/v2 v2.1.3 h1:DQ21UU0VSsuGy8+pcMJHDS0CV1bKmJmxsJYK8l3MiLU=
+github.com/ethereum/c-kzg-4844/v2 v2.1.3/go.mod h1:fyNcYI/yAuLWJxf4uzVtS8VDKeoAaRM8G/+ADz/pRdA=
github.com/ethereum/evmc/v11 v11.0.0 h1:eNSnttQ4fpGXt0Jo9mNbyE8o5vSo9GOBAGkhXcSEvjw=
github.com/ethereum/evmc/v11 v11.0.0/go.mod h1:Jx1hvf5HxIU/t0iOVyDcK9NsKa943peXBtuDQEcyQ7Y=
+github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab h1:rvv6MJhy07IMfEKuARQ9TKojGqLVNxQajaXEp/BoqSk=
+github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab/go.mod h1:IuLm4IsPipXKF7CW5Lzf68PIbZ5yl7FFd74l/E0o9A8=
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
@@ -115,8 +117,8 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
-github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk=
-github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
+github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -138,8 +140,8 @@ github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iP
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
-github.com/holiman/billy v0.0.0-20240322075458-72a4e81ec6da h1:8qEhdMGSUx67L2s5aGQinJhOwLfIRKLRBHPQq8m6WxE=
-github.com/holiman/billy v0.0.0-20240322075458-72a4e81ec6da/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc=
+github.com/holiman/billy v0.0.0-20250707135307-f2f9b9aae7db h1:IZUYC/xb3giYwBLMnr8d0TGTzPKFGNTCGgGLoyeX330=
+github.com/holiman/billy v0.0.0-20250707135307-f2f9b9aae7db/go.mod h1:xTEYN9KCHxuYHs+NmrmzFcnvHMzLLNiGFafCb1n3Mfg=
github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA=
github.com/holiman/uint256 v1.3.2 h1:a9EgMPSC1AAaj1SZL5zIQD3WbwTuHrMGOerLjGmM/TA=
@@ -271,8 +273,8 @@ github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
-github.com/supranational/blst v0.3.14 h1:xNMoHRJOTwMn63ip6qoWJ2Ymgvj7E2b9jY2FAwY+qRo=
-github.com/supranational/blst v0.3.14/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
+github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe h1:nbdqkIGOGfUAD54q1s2YBcBz/WcsxCO9HUQ4aGV5hUw=
+github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU=
@@ -355,9 +357,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
-golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
+golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
+golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
diff --git a/gossip/common_test.go b/gossip/common_test.go
index 23f0740a9..d23c135b8 100644
--- a/gossip/common_test.go
+++ b/gossip/common_test.go
@@ -573,17 +573,17 @@ func (env *testEnv) SubscribeFilterLogs(ctx context.Context, query ethereum.Filt
// CallMsgToMessage converts the given CallMsg to an evmcore.Message to allow passing it as a transaction simulator.
func CallMsgToMessage(msg ethereum.CallMsg) *core.Message {
return &core.Message{
- From: msg.From,
- To: msg.To,
- GasPrice: msg.GasPrice,
- GasTipCap: msg.GasTipCap,
- GasFeeCap: msg.GasFeeCap,
- GasLimit: msg.Gas,
- Value: msg.Value,
- Nonce: 0,
- SkipNonceChecks: true,
- SkipFromEOACheck: true,
- Data: msg.Data,
- AccessList: msg.AccessList,
+ From: msg.From,
+ To: msg.To,
+ GasPrice: msg.GasPrice,
+ GasTipCap: msg.GasTipCap,
+ GasFeeCap: msg.GasFeeCap,
+ GasLimit: msg.Gas,
+ Value: msg.Value,
+ Nonce: 0,
+ SkipNonceChecks: true,
+ SkipTransactionChecks: true,
+ Data: msg.Data,
+ AccessList: msg.AccessList,
}
}
diff --git a/gossip/evmstore/carmen.go b/gossip/evmstore/carmen.go
index 696f3e9be..de10701a3 100644
--- a/gossip/evmstore/carmen.go
+++ b/gossip/evmstore/carmen.go
@@ -235,7 +235,7 @@ func (c *CarmenStateDB) SetNonce(addr common.Address, nonce uint64, _ tracing.No
c.db.SetNonce(cc.Address(addr), nonce)
}
-func (c *CarmenStateDB) SetCode(addr common.Address, code []byte) []byte {
+func (c *CarmenStateDB) SetCode(addr common.Address, code []byte, _ tracing.CodeChangeReason) []byte {
old := bytes.Clone(c.db.GetCode(cc.Address(addr)))
c.db.SetCode(cc.Address(addr), code)
return old
diff --git a/gossip/evmstore/statedb_logger.go b/gossip/evmstore/statedb_logger.go
index ad368ef9c..f9016f0ba 100644
--- a/gossip/evmstore/statedb_logger.go
+++ b/gossip/evmstore/statedb_logger.go
@@ -56,9 +56,9 @@ func (l *LoggingStateDB) SubBalance(addr common.Address, amount *uint256.Int, re
return prev
}
-func (l *LoggingStateDB) SetCode(addr common.Address, code []byte) []byte {
+func (l *LoggingStateDB) SetCode(addr common.Address, code []byte, reason tracing.CodeChangeReason) []byte {
prevCodeHash := l.GetCodeHash(addr)
- prevCode := l.StateDB.SetCode(addr, code)
+ prevCode := l.StateDB.SetCode(addr, code, reason)
if l.logger.OnCodeChange != nil {
l.logger.OnCodeChange(addr, prevCodeHash, prevCode, l.GetCodeHash(addr), code)
}
diff --git a/gossip/gasprice/reactive.go b/gossip/gasprice/reactive.go
index b21c2db3d..c988fc12a 100644
--- a/gossip/gasprice/reactive.go
+++ b/gossip/gasprice/reactive.go
@@ -22,6 +22,7 @@ import (
"sync/atomic"
"time"
+ "github.com/0xsoniclabs/sonic/utils"
"github.com/Fantom-foundation/lachesis-base/utils/piecefunc"
"github.com/ethereum/go-ethereum/core/types"
)
@@ -238,11 +239,12 @@ func (gpo *Oracle) calcTxpoolStat() txpoolStat {
const maxTxsToIndex = 400
minGasPrice := gpo.backend.GetRules().Economy.MinGasPrice
+ minGasPriceU256 := utils.BigIntToUint256Clamped(minGasPrice)
// txs are sorted from large price to small
sorted := txs
sort.Slice(sorted, func(i, j int) bool {
a, b := sorted[i], sorted[j]
- cmp := a.EffectiveGasTipCmp(b, minGasPrice)
+ cmp := a.EffectiveGasTipCmp(b, minGasPriceU256)
if cmp == 0 {
return a.Gas() > b.Gas()
}
diff --git a/integration/makegenesis/genesis.go b/integration/makegenesis/genesis.go
index a28a8dab7..5b5d3fe3e 100644
--- a/integration/makegenesis/genesis.go
+++ b/integration/makegenesis/genesis.go
@@ -105,7 +105,7 @@ func (b *GenesisBuilder) SetCode(acc common.Address, code []byte) {
if len(b.blocks) > 0 {
panic("cannot add code after block zero is finalized")
}
- b.tmpStateDB.SetCode(acc, code)
+ b.tmpStateDB.SetCode(acc, code, tracing.CodeChangeGenesis)
}
func (b *GenesisBuilder) SetNonce(acc common.Address, nonce uint64) {
diff --git a/inter/state/adapter_mock.go b/inter/state/adapter_mock.go
index d9897693c..038ba87f6 100644
--- a/inter/state/adapter_mock.go
+++ b/inter/state/adapter_mock.go
@@ -1,19 +1,3 @@
-// Copyright 2025 Sonic Operations Ltd
-// This file is part of the Sonic Client
-//
-// Sonic is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Sonic is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with Sonic. If not, see .
-
// Code generated by MockGen. DO NOT EDIT.
// Source: adapter.go
//
@@ -584,17 +568,17 @@ func (mr *MockStateDBMockRecorder) SetBalance(addr, amount any) *gomock.Call {
}
// SetCode mocks base method.
-func (m *MockStateDB) SetCode(arg0 common.Address, arg1 []byte) []byte {
+func (m *MockStateDB) SetCode(arg0 common.Address, arg1 []byte, arg2 tracing.CodeChangeReason) []byte {
m.ctrl.T.Helper()
- ret := m.ctrl.Call(m, "SetCode", arg0, arg1)
+ ret := m.ctrl.Call(m, "SetCode", arg0, arg1, arg2)
ret0, _ := ret[0].([]byte)
return ret0
}
// SetCode indicates an expected call of SetCode.
-func (mr *MockStateDBMockRecorder) SetCode(arg0, arg1 any) *gomock.Call {
+func (mr *MockStateDBMockRecorder) SetCode(arg0, arg1, arg2 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
- return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCode", reflect.TypeOf((*MockStateDB)(nil).SetCode), arg0, arg1)
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCode", reflect.TypeOf((*MockStateDB)(nil).SetCode), arg0, arg1, arg2)
}
// SetNonce mocks base method.
diff --git a/opera/contracts/evmwriter/evm_writer.go b/opera/contracts/evmwriter/evm_writer.go
index 08d182ca3..fe938c666 100644
--- a/opera/contracts/evmwriter/evm_writer.go
+++ b/opera/contracts/evmwriter/evm_writer.go
@@ -132,7 +132,7 @@ func (PreCompiledContract) Run(stateDB vm.StateDB, _ vm.BlockContext, txCtx vm.T
}
suppliedGas -= cost
if accTo != accFrom {
- stateDB.SetCode(accTo, code)
+ stateDB.SetCode(accTo, code, tracing.CodeChangeUnspecified)
}
} else if bytes.Equal(input[:4], swapCodeMethodID) {
input = input[4:]
@@ -165,8 +165,8 @@ func (PreCompiledContract) Run(stateDB vm.StateDB, _ vm.BlockContext, txCtx vm.T
}
suppliedGas -= cost
if acc0 != acc1 {
- stateDB.SetCode(acc0, code1)
- stateDB.SetCode(acc1, code0)
+ stateDB.SetCode(acc0, code1, tracing.CodeChangeUnspecified)
+ stateDB.SetCode(acc1, code0, tracing.CodeChangeUnspecified)
}
} else if bytes.Equal(input[:4], setStorageMethodID) {
input = input[4:]
diff --git a/opera/vm_config.go b/opera/vm_config.go
index 47ba808c8..dd6a225e9 100644
--- a/opera/vm_config.go
+++ b/opera/vm_config.go
@@ -37,7 +37,7 @@ var sonicVmConfig = func() vm.Config {
// For tracing, Geth's EVM is used.
gethFactory := func(evm *vm.EVM) vm.Interpreter {
- return vm.NewEVMInterpreter(evm)
+ return vm.NewEvmInterpreter(evm)
}
return vm.Config{
diff --git a/tests/db_factory.go b/tests/db_factory.go
index b5a6995d4..06cefb13a 100644
--- a/tests/db_factory.go
+++ b/tests/db_factory.go
@@ -37,8 +37,8 @@ func (f carmenFactory) NewTestStateDB(accounts types.GenesisAlloc) tests.StateTe
carmenstatedb := carmen.CreateCustomStateDBUsing(f.st, 1024)
statedb := evmstore.CreateCarmenStateDb(carmenstatedb)
for addr, a := range accounts {
- statedb.SetCode(addr, a.Code)
- statedb.SetNonce(addr, a.Nonce, tracing.NonceChangeUnspecified)
+ statedb.SetCode(addr, a.Code, tracing.CodeChangeGenesis)
+ statedb.SetNonce(addr, a.Nonce, tracing.NonceChangeGenesis)
statedb.SetBalance(addr, uint256.MustFromBig(a.Balance))
for k, v := range a.Storage {
statedb.SetState(addr, k, v)
diff --git a/tests/eth_rpc_api_functions_test.go b/tests/eth_rpc_api_functions_test.go
index 132631732..b1efc6954 100644
--- a/tests/eth_rpc_api_functions_test.go
+++ b/tests/eth_rpc_api_functions_test.go
@@ -46,6 +46,7 @@ var (
knownMissingAPIs = namespaceMap{
"eth": {
"SimulateV1": struct{}{},
+ "Config": struct{}{}, // TODO: issue (https://github.com/0xsoniclabs/sonic-admin/issues/355)
},
"debug": {
"DbAncient": struct{}{},
diff --git a/utils/int.go b/utils/int.go
index 5f0b75802..2af34a236 100644
--- a/utils/int.go
+++ b/utils/int.go
@@ -33,6 +33,23 @@ func BigIntToUint256(value *big.Int) *uint256.Int {
return new(uint256.Int).SetBytes(bytes)
}
+// BigIntToUint256Clamped converts a big.Int to a uint256.Int. If the value is
+// negative, zero is returned. If the value is too large to fit
+// into a uint256.Int, the maximum uint256.Int value is returned.
+func BigIntToUint256Clamped(value *big.Int) *uint256.Int {
+ if value == nil {
+ return nil
+ }
+ if value.Sign() <= 0 {
+ return uint256.NewInt(0)
+ }
+ res, overflow := uint256.FromBig(value)
+ if overflow {
+ res.SetAllOne()
+ }
+ return res
+}
+
func Uint256ToBigInt(value *uint256.Int) *big.Int {
return new(big.Int).SetBytes(value.Bytes())
}
diff --git a/utils/int_test.go b/utils/int_test.go
new file mode 100644
index 000000000..b07756617
--- /dev/null
+++ b/utils/int_test.go
@@ -0,0 +1,81 @@
+// Copyright 2025 Sonic Operations Ltd
+// This file is part of the Sonic Client
+//
+// Sonic is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Sonic is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with Sonic. If not, see .
+
+package utils
+
+import (
+ "math/big"
+ "testing"
+
+ "github.com/holiman/uint256"
+ "github.com/stretchr/testify/require"
+)
+
+func TestBigIntToU256_Clamps_Inputs(t *testing.T) {
+ tests := map[string]struct {
+ input *big.Int
+ expected *uint256.Int
+ }{
+ "nil input": {
+ input: nil,
+ expected: nil,
+ },
+ "negative input": {
+ input: big.NewInt(-1),
+ expected: uint256.NewInt(0),
+ },
+ "zero input": {
+ input: big.NewInt(0),
+ expected: uint256.NewInt(0),
+ },
+ "small positive input": {
+ input: big.NewInt(42),
+ expected: uint256.NewInt(42),
+ },
+ "max uint256 input": {
+ input: func() *big.Int {
+ b := new(big.Int).SetUint64(1)
+ b.Lsh(b, 256)
+ b.Sub(b, big.NewInt(1))
+ return b
+ }(),
+ expected: func() *uint256.Int {
+ u := new(uint256.Int)
+ u.SetAllOne()
+ return u
+ }(),
+ },
+ "overflowing input": {
+ input: func() *big.Int {
+ b := new(big.Int).SetUint64(1)
+ b.Lsh(b, 256)
+ return b
+ }(),
+ expected: func() *uint256.Int {
+ u := new(uint256.Int)
+ u.SetAllOne()
+ return u
+ }(),
+ },
+ }
+
+ for name, test := range tests {
+ t.Run(name, func(t *testing.T) {
+ got := BigIntToUint256Clamped(test.input)
+ require.Equal(t, test.expected, got, "BigIntToUint256Clamped(%v) = %v; want %v", test.input, got, test.expected)
+ })
+ }
+}