fix(evm): goerli coinbase (#2377)

This commit is contained in:
Roman Krasiuk
2023-04-25 13:32:51 +03:00
committed by GitHub
parent dc8308f820
commit eebcb03fea
5 changed files with 45 additions and 14 deletions

View File

@@ -69,11 +69,12 @@ pub use revm_primitives::JumpMap;
pub use serde_helper::JsonU256;
pub use storage::StorageEntry;
pub use transaction::{
util::secp256k1::sign_message, AccessList, AccessListItem, AccessListWithGasUsed,
FromRecoveredTransaction, IntoRecoveredTransaction, InvalidTransactionError, Signature,
Transaction, TransactionKind, TransactionMeta, TransactionSigned, TransactionSignedEcRecovered,
TransactionSignedNoHash, TxEip1559, TxEip2930, TxLegacy, TxType, EIP1559_TX_TYPE_ID,
EIP2930_TX_TYPE_ID, LEGACY_TX_TYPE_ID,
util::secp256k1::{recover_signer, sign_message},
AccessList, AccessListItem, AccessListWithGasUsed, FromRecoveredTransaction,
IntoRecoveredTransaction, InvalidTransactionError, Signature, Transaction, TransactionKind,
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
TxEip1559, TxEip2930, TxLegacy, TxType, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};
pub use withdrawal::Withdrawal;

View File

@@ -123,7 +123,7 @@ impl Signature {
// NOTE: we are removing error from underlying crypto library as it will restrain primitive
// errors and we care only if recovery is passing or not.
secp256k1::recover(&sig, hash.as_fixed_bytes()).ok()
secp256k1::recover_signer(&sig, hash.as_fixed_bytes()).ok()
}
/// Turn this signature into its byte

View File

@@ -13,7 +13,7 @@ pub(crate) mod secp256k1 {
pub(crate) use ::secp256k1::Error;
/// secp256k1 signer recovery
pub(crate) fn recover(sig: &[u8; 65], msg: &[u8; 32]) -> Result<Address, Error> {
pub fn recover_signer(sig: &[u8; 65], msg: &[u8; 32]) -> Result<Address, Error> {
let sig =
RecoverableSignature::from_compact(&sig[0..64], RecoveryId::from_i32(sig[64] as i32)?)?;
@@ -49,6 +49,6 @@ mod tests {
let hash = hex!("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad");
let out: Address = hex!("c08b5542d177ac6686946920409741463a15dddb").into();
assert_eq!(secp256k1::recover(&sig, &hash), Ok(out));
assert_eq!(secp256k1::recover_signer(&sig, &hash), Ok(out));
}
}