Skip to content

Commit 0eabe2f

Browse files
authored
chore: update libevm version (#1672)
1 parent fe7ec64 commit 0eabe2f

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

core/state_transition.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
"github.com/ava-labs/libevm/core/types"
3838
"github.com/ava-labs/libevm/core/vm"
3939
"github.com/ava-labs/libevm/crypto/kzg4844"
40+
"github.com/ava-labs/libevm/log"
4041
ethparams "github.com/ava-labs/libevm/params"
4142
"github.com/ava-labs/subnet-evm/params"
4243
"github.com/ava-labs/subnet-evm/plugin/evm/vmerrors"
@@ -494,6 +495,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
494495
// - prepare accessList(post-berlin)
495496
// - reset transient storage(eip 1153)
496497
st.state.Prepare(rules, msg.From, st.evm.Context.Coinbase, msg.To, vm.ActivePrecompiles(rules), msg.AccessList)
498+
snap := st.state.Snapshot() // store in case execution invalidated
497499

498500
var (
499501
ret []byte
@@ -515,6 +517,17 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
515517
fee.Mul(fee, price)
516518
st.state.AddBalance(st.evm.Context.Coinbase, fee)
517519

520+
if err := st.evm.ExecutionInvalidated(); err != nil {
521+
log.Warn(
522+
"tx marked as invalidated",
523+
"from", st.msg.From,
524+
"nonce", st.msg.Nonce,
525+
"err", err,
526+
)
527+
st.state.RevertToSnapshot(snap)
528+
return nil, err
529+
}
530+
518531
return &ExecutionResult{
519532
UsedGas: st.gasUsed(),
520533
RefundedGas: gasRefund,

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/antithesishq/antithesis-sdk-go v0.3.8
88
github.com/ava-labs/avalanchego v1.13.4-rc.2
99
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.9
10-
github.com/ava-labs/libevm v1.13.14-0.3.0.rc.3
10+
github.com/ava-labs/libevm v1.13.14-0.3.0.rc.6
1111
github.com/davecgh/go-spew v1.1.1
1212
github.com/deckarep/golang-set/v2 v2.1.0
1313
github.com/fjl/gencodec v0.1.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ github.com/ava-labs/coreth v0.15.3-rc.1 h1:v7CMNT3tVi1cFp/6I9Xlln372+e6ztwAaCzW6
3030
github.com/ava-labs/coreth v0.15.3-rc.1/go.mod h1:80rG3mFUUPEfx9vj5QCAgKcrd1SH2UbbTAHKqYJfUpI=
3131
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.9 h1:zw0g+cUbZDsGdWx1PKmBChkpy+ixL3QgiI86DUOuXvo=
3232
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.9/go.mod h1:cq89ua3iiZ5wPBALTEQS5eG8DIZcs7ov6OiL4YR1BVY=
33-
github.com/ava-labs/libevm v1.13.14-0.3.0.rc.3 h1:qYwmFh5fG8T4ShagvJs6TNXTfVMdSyvQYwVZb3tx+4k=
34-
github.com/ava-labs/libevm v1.13.14-0.3.0.rc.3/go.mod h1:zP/DOcABRWargBmUWv1jXplyWNcfmBy9cxr0lw3LW3g=
33+
github.com/ava-labs/libevm v1.13.14-0.3.0.rc.6 h1:tyM659nDOknwTeU4A0fUVsGNIU7k0v738wYN92nqs/Y=
34+
github.com/ava-labs/libevm v1.13.14-0.3.0.rc.6/go.mod h1:zP/DOcABRWargBmUWv1jXplyWNcfmBy9cxr0lw3LW3g=
3535
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
3636
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
3737
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=

latest-coreth-commit.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
204bdcf27dbf8982d7d61874c003aaf8b4daaa8b
44

55
# Notes:
6-
- Last PR done is currently #1064
7-
- Coreth PR 1066 has already been synced (ahead of schedule) - see https://github.com/ava-labs/subnet-evm/pull/1651
6+
- Last PR done is currently #1066
87
- Coreth PR 1070 has already been synced (ahead of schedule) - see https://github.com/ava-labs/subnet-evm/pull/1652
98
- Coreth PR 1071 has already been synced (ahead of schedule) - see https://github.com/ava-labs/subnet-evm/pull/1653
109
- Coreth PR 1073 has already been synced (ahead of schedule) - see https://github.com/ava-labs/subnet-evm/pull/1659
10+
- Coreth PR 1087 has already been synced (ahead of schedule) - see https://github.com/ava-labs/subnet-evm/pull/1672
11+
- Coreth PR 1088 has already been synced (ahead of schedule) - see https://github.com/ava-labs/subnet-evm/pull/1672

params/hooks_libevm.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ func makePrecompile(contract contract.StatefulPrecompiledContract) libevm.Precom
8686
predicateResults: predicateResults,
8787
},
8888
}
89+
90+
if callType := env.IncomingCallType(); callType == vm.DelegateCall || callType == vm.CallCode {
91+
env.InvalidateExecution(fmt.Errorf("precompile cannot be called with %s", callType))
92+
}
8993
return contract.Run(accessibleState, env.Addresses().Caller, env.Addresses().Self, input, suppliedGas, env.ReadOnly())
9094
}
9195
return vm.NewStatefulPrecompile(legacy.PrecompiledStatefulContract(run).Upgrade())

0 commit comments

Comments
 (0)