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

Update spec tests to [email protected] #11952

Merged
merged 6 commits into from
Sep 12, 2024
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
15 changes: 15 additions & 0 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package core

import (
"bytes"
"errors"
"fmt"
"slices"

Expand Down Expand Up @@ -354,6 +355,9 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*evmtype
auths := msg.Authorizations()
verifiedAuthorities := make([]libcommon.Address, 0)
if len(auths) > 0 {
if contractCreation {
return nil, errors.New("contract creation not allowed with type4 txs")
}
var b [33]byte
data := bytes.NewBuffer(nil)
for i, auth := range auths {
Expand All @@ -366,6 +370,17 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*evmtype
}

// 2. authority recover

// TODO: these signature checks should ideally be in RecoverSigner, a new PR on 7702 should simplify this
// adding this to pass tests for now
if auth.S.Cmp(crypto.Secp256k1halfN) > 0 {
return nil, fmt.Errorf("invalid signature S, skipping, auth index %d", i)
}

if !auth.V.Eq(u256.Num0) && !auth.V.Eq(u256.Num1) {
return nil, fmt.Errorf("invalid v value: %d", auth.V.Uint64())
}

authorityPtr, err := auth.RecoverSigner(data, b[:])
if err != nil {
log.Debug("authority recover failed, skipping", "err", err, "auth index", i)
Expand Down
2 changes: 1 addition & 1 deletion crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const DigestLength = 32
var (
secp256k1N = new(uint256.Int).SetBytes(hexutil.MustDecode("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"))
secp256k1NBig = secp256k1N.ToBig()
secp256k1halfN = new(uint256.Int).Div(secp256k1N, u256.Num2)
Secp256k1halfN = new(uint256.Int).Div(secp256k1N, u256.Num2)
)

var errInvalidPubkey = errors.New("invalid secp256k1 public key")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"comment": "`execution-spec-tests` generated test",
"filling-transition-tool": "ethereumjs t8n v1",
"description": "Test function documentation:\n\n Test the BLS12_G1ADD precompile using different call types.",
"url": "https://github.com/ethereum/execution-spec-tests/blob/pectra-devnet-3@v1.4.0/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py#L204",
"url": "https://github.com/ethereum/execution-spec-tests/blob/pectra-devnet-3@v1.5.0/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py#L204",
"reference-spec": "https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2537.md",
"reference-spec-version": "cd0f016ad0c4c68b8b1f5c502ef61ab9353b6e5e"
}
Expand Down Expand Up @@ -506,7 +506,7 @@
"comment": "`execution-spec-tests` generated test",
"filling-transition-tool": "ethereumjs t8n v1",
"description": "Test function documentation:\n\n Test the BLS12_G1ADD precompile using different call types.",
"url": "https://github.com/ethereum/execution-spec-tests/blob/pectra-devnet-3@v1.4.0/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py#L204",
"url": "https://github.com/ethereum/execution-spec-tests/blob/pectra-devnet-3@v1.5.0/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py#L204",
"reference-spec": "https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2537.md",
"reference-spec-version": "cd0f016ad0c4c68b8b1f5c502ef61ab9353b6e5e"
}
Expand Down Expand Up @@ -762,7 +762,7 @@
"comment": "`execution-spec-tests` generated test",
"filling-transition-tool": "ethereumjs t8n v1",
"description": "Test function documentation:\n\n Test the BLS12_G1ADD precompile using different call types.",
"url": "https://github.com/ethereum/execution-spec-tests/blob/pectra-devnet-3@v1.4.0/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py#L204",
"url": "https://github.com/ethereum/execution-spec-tests/blob/pectra-devnet-3@v1.5.0/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py#L204",
"reference-spec": "https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2537.md",
"reference-spec-version": "cd0f016ad0c4c68b8b1f5c502ef61ab9353b6e5e"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"comment": "`execution-spec-tests` generated test",
"filling-transition-tool": "ethereumjs t8n v1",
"description": "Test function documentation:\n\n Test the BLS12_G1ADD precompile gas requirements.",
"url": "https://github.com/ethereum/execution-spec-tests/blob/pectra-devnet-3@v1.4.0/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py#L170",
"url": "https://github.com/ethereum/execution-spec-tests/blob/pectra-devnet-3@v1.5.0/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py#L170",
"reference-spec": "https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2537.md",
"reference-spec-version": "cd0f016ad0c4c68b8b1f5c502ef61ab9353b6e5e"
}
Expand Down Expand Up @@ -502,7 +502,7 @@
"comment": "`execution-spec-tests` generated test",
"filling-transition-tool": "ethereumjs t8n v1",
"description": "Test function documentation:\n\n Test the BLS12_G1ADD precompile gas requirements.",
"url": "https://github.com/ethereum/execution-spec-tests/blob/pectra-devnet-3@v1.4.0/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py#L170",
"url": "https://github.com/ethereum/execution-spec-tests/blob/pectra-devnet-3@v1.5.0/tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py#L170",
"reference-spec": "https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2537.md",
"reference-spec-version": "cd0f016ad0c4c68b8b1f5c502ef61ab9353b6e5e"
}
Expand Down
Loading
Loading