Skip to content
Merged
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
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/smartcontractkit/chainlink-evm

go 1.24.1
go 1.24.2

require (
github.com/ethereum/go-ethereum v1.15.3
Expand All @@ -21,9 +21,9 @@ require (
github.com/prometheus/client_model v0.6.1
github.com/prometheus/common v0.63.0
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250515101002-90b1d1b66ce4
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250521163734-723cad356d85
github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20250514200342-5169fbe9e28d
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250514200342-5169fbe9e28d
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250521171314-715526394719
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250514200342-5169fbe9e28d
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250514200342-5169fbe9e28d
github.com/smartcontractkit/chainlink-protos/svr v1.1.0
Expand Down Expand Up @@ -186,7 +186,7 @@ require (
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250219182151-9fdb1cabc7b2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
google.golang.org/grpc v1.71.0 // indirect
google.golang.org/grpc v1.72.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,12 @@ github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJV
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250515101002-90b1d1b66ce4 h1:kWAHWz0JFWzJ9pw5mFGRWSeudqHJOy1ttDTv72WsdG4=
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250515101002-90b1d1b66ce4/go.mod h1:uNF6+noody47ZdmRwymDZAnQ7eKTXLzMKvl41LA63lo=
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250521163734-723cad356d85 h1:EMnHaq7rzuB4m8Ebd+/C/yBVBz088OSrV5JbZV+An04=
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250521163734-723cad356d85/go.mod h1:TF9ZqBV0QA3X1T4BoLGp0FfJpOQOcQ+ggKu1MlsWKYw=
github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20250514200342-5169fbe9e28d h1:T2JVrbq6jwDUA/bb8Gq/FsTcFQnuslx4AgQgYUC5RlQ=
github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20250514200342-5169fbe9e28d/go.mod h1:NVoJQoPYr6BorpaXTusoIH1IYTySCmanQ8Q1yv3mNh4=
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250514200342-5169fbe9e28d h1:+I0fUEPUE2W45bjDrPsZgTogK//1yZo29hIREgDTGL8=
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250514200342-5169fbe9e28d/go.mod h1:7SIisRODXILBOqkUYvdfosemV6ttDTR+AjGHPws7DoA=
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250521171314-715526394719 h1:H4+kuSRLdd/oQYZxipnIG/uhBkY7af/SSDW5xGQNhFY=
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250521171314-715526394719/go.mod h1:X+a4k2a+2G2/yeAaRQMCTLmlhNdQYAeN6v+ZpLzRZww=
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250514200342-5169fbe9e28d h1:D2wyPOBhJXueq/P7Ux1HCntZ7pUB2rPXQxSeO3cN7iQ=
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250514200342-5169fbe9e28d/go.mod h1:jo+cUqNcHwN8IF7SInQNXDZ8qzBsyMpnLdYbDswviFc=
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250514200342-5169fbe9e28d h1:9ys7cetSe40Ne53Z0xKfvrs3TfDjJuBHIsVUA4hOzyk=
Expand Down Expand Up @@ -1189,8 +1189,8 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg=
google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM=
google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
9 changes: 5 additions & 4 deletions pkg/txmgr/txmgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,10 +692,10 @@ func TestTxm_GetTransactionFee(t *testing.T) {
require.NoError(t, err)

_, err = txm.GetTransactionFee(ctx, idempotencyKey)
require.Error(t, err, "tx status is not finalized")
require.NoError(t, err)
})

t.Run("returns correct fee for finalized state", func(t *testing.T) {
t.Run("returns correct fee", func(t *testing.T) {
idempotencyKey := uuid.New().String()
fromAddress := memKS.MustCreate(t)

Expand All @@ -720,13 +720,13 @@ func TestTxm_GetTransactionFee(t *testing.T) {
// insert receipt
var r txmgr.Receipt
r = newEthReceipt(42, utils.NewHash(), attemptD.Hash, 0x1)
expFee := r.Receipt.EffectiveGasPrice.Int64() * int64(r.Receipt.GasUsed)
expFee := r.Receipt.EffectiveGasPrice.Uint64()*r.Receipt.GasUsed + r.Receipt.L1Fee.Uint64()
_, err = txStore.InsertReceipt(ctx, &r.Receipt)
require.NoError(t, err)

fee, err := txm.GetTransactionFee(ctx, idempotencyKey)
require.NoError(t, err)
require.Equal(t, big.NewInt(expFee), fee.TransactionFee)
require.Equal(t, new(big.Int).SetUint64(expFee), fee.TransactionFee)
})
}

Expand Down Expand Up @@ -994,6 +994,7 @@ func newEthReceipt(blockNumber int64, blockHash common.Hash, txHash common.Hash,
TransactionIndex: transactionIndex,
GasUsed: 123,
EffectiveGasPrice: big.NewInt(55),
L1Fee: big.NewInt(1),
Status: status,
}

Expand Down
14 changes: 13 additions & 1 deletion pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type Receipt struct {
BlockNumber *big.Int `json:"blockNumber,omitempty"`
TransactionIndex uint `json:"transactionIndex"`
EffectiveGasPrice *big.Int `json:"effectiveGasPrice,omitempty"` // For compatibility with old blocks
L1Fee *big.Int `json:"l1Fee,omitempty"` // For L2 chains only
RevertReason []byte `json:"revertReason,omitempty"` // Only provided by Hedera
}

Expand All @@ -92,6 +93,7 @@ func FromGethReceipt(gr *gethTypes.Receipt) *Receipt {
gr.TransactionIndex,
gr.EffectiveGasPrice,
nil,
nil,
}
}

Expand Down Expand Up @@ -126,7 +128,8 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
BlockNumber *hexutil.Big `json:"blockNumber,omitempty"`
TransactionIndex hexutil.Uint `json:"transactionIndex"`
RevertReason hexutil.Bytes `json:"revertReason,omitempty"` // Only provided by Hedera
EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice"`
EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice,omitempty"`
L1Fee *hexutil.Big `json:"l1Fee,omitempty"` // For L2 chains only
}
var enc Receipt
enc.PostState = r.PostState
Expand All @@ -142,6 +145,7 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
enc.TransactionIndex = hexutil.Uint(r.TransactionIndex)
enc.RevertReason = r.RevertReason
enc.EffectiveGasPrice = (*hexutil.Big)(r.EffectiveGasPrice)
enc.L1Fee = (*hexutil.Big)(r.L1Fee)
return json.Marshal(&enc)
}

Expand All @@ -161,6 +165,7 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
TransactionIndex *hexutil.Uint `json:"transactionIndex"`
RevertReason *hexutil.Bytes `json:"revertReason,omitempty"` // Only provided by Hedera
EffectiveGasPrice *hexutil.Big `json:"effectiveGasPrice,omitempty"`
L1Fee *hexutil.Big `json:"l1Fee,omitempty"` // For L2 chains only
}
var dec Receipt
if err := json.Unmarshal(input, &dec); err != nil {
Expand Down Expand Up @@ -197,6 +202,9 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
if dec.EffectiveGasPrice != nil {
r.EffectiveGasPrice = (*big.Int)(dec.EffectiveGasPrice)
}
if dec.L1Fee != nil {
r.L1Fee = (*big.Int)(dec.L1Fee)
}
if dec.TransactionIndex != nil {
r.TransactionIndex = uint(*dec.TransactionIndex)
}
Expand Down Expand Up @@ -239,6 +247,10 @@ func (r *Receipt) GetEffectiveGasPrice() *big.Int {
return r.EffectiveGasPrice
}

func (r *Receipt) GetL1Fee() *big.Int {
return r.L1Fee
}

func (r *Receipt) GetTransactionIndex() uint {
return r.TransactionIndex
}
Expand Down
Loading