Skip to content

Commit

Permalink
chore(p256): adjust p256 precompile address (evmos#2110)
Browse files Browse the repository at this point in the history
* adjust p256 precompile address

* address linter

* add changelog entry
  • Loading branch information
MalteHerrmann authored Dec 1, 2023
1 parent ca0f3e4 commit 56b1993
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (bank) [#2096](https://github.com/evmos/evmos/pull/2096) Add `bank` precompile integration tests.
- (osmosis-outpost) [#2077](https://github.com/evmos/evmos/pull/2077) Update Osmosis outpost to use cross-chain swap contract V1.
- (app) [#2104](https://github.com/evmos/evmos/pull/2104) Refactor code to use `sdkmath.Int` and `sdkmath.LegacyDec` instead of the SDK types
- (p256-precompile) [#2110](https://github.com/evmos/evmos/pull/2110) Adjust `p256` precompile address.

### Bug Fixes

Expand Down
5 changes: 2 additions & 3 deletions precompiles/p256/p256.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,16 @@ const (
)

// PrecompileAddress defines the hex address of the p256 precompiled contract.
const PrecompileAddress = "0x0000000000000000000000000000000000000013"
const PrecompileAddress = "0x000000000000000000000000000000000000000b"

// Precompile secp256r1 (P256) signature verification
// implemented as a native contract as per EIP-7212.
// See https://eips.ethereum.org/EIPS/eip-7212 for details
type Precompile struct{}

// Address defines the address of the p256 precompiled contract.
// address: 0x0000000000000000000000000000000000000013
func (Precompile) Address() common.Address {
return common.BytesToAddress([]byte{19})
return common.HexToAddress(PrecompileAddress)
}

// RequiredGas returns the static gas required to execute the precompiled contract.
Expand Down
3 changes: 2 additions & 1 deletion x/evm/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
"github.com/evmos/evmos/v16/precompiles/p256"
"github.com/evmos/evmos/v16/types"
"github.com/evmos/evmos/v16/utils"
"golang.org/x/exp/slices"
Expand All @@ -32,7 +33,7 @@ var (
DefaultEnableCall = true
// AvailableEVMExtensions defines the default active precompiles
AvailableEVMExtensions = []string{
"0x0000000000000000000000000000000000000013", // P256 precompile
p256.PrecompileAddress, // P256 precompile
"0x0000000000000000000000000000000000000400", // Bech32 precompile
"0x0000000000000000000000000000000000000800", // Staking precompile
"0x0000000000000000000000000000000000000801", // Distribution precompile
Expand Down

0 comments on commit 56b1993

Please sign in to comment.