From b736906dc7394df55fddbeb38b5f1b5ca34e8450 Mon Sep 17 00:00:00 2001 From: andri lim Date: Tue, 15 Oct 2024 21:09:16 +0700 Subject: [PATCH] Fix Authorization fields name to v, r, s (#749) --- .github/workflows/ci.yml | 4 ++-- eth/common/headers.nim | 10 +++++----- eth/common/transactions.nim | 6 +++--- eth/common/transactions_rlp.nim | 12 ++++++------ tests/common/test_transactions.nim | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37c8b890..f2d4340f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,8 +69,8 @@ jobs: if: runner.os == 'Linux' && matrix.target.cpu == 'i386' run: | sudo dpkg --add-architecture i386 - sudo apt-fast update -qq - sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \ + sudo apt-get update -qq + sudo DEBIAN_FRONTEND='noninteractive' apt-get install \ --no-install-recommends -yq gcc-multilib g++-multilib \ libz-dev:i386 libbz2-dev:i386 liblz4-dev:i386 libssl-dev:i386 mkdir -p external/bin diff --git a/eth/common/headers.nim b/eth/common/headers.nim index 8c11256b..1bc00969 100644 --- a/eth/common/headers.nim +++ b/eth/common/headers.nim @@ -33,12 +33,12 @@ type ## AKA mix_digest in some specs - Hash32 in the eth API but Bytes32 in ## the execution API and spec! nonce*: Bytes8 - baseFeePerGas*: Opt[UInt256] # EIP-1559 - withdrawalsRoot*: Opt[Hash32] # EIP-4895 - blobGasUsed*: Opt[uint64] # EIP-4844 - excessBlobGas*: Opt[uint64] # EIP-4844 + baseFeePerGas*: Opt[UInt256] # EIP-1559 + withdrawalsRoot*: Opt[Hash32] # EIP-4895 + blobGasUsed*: Opt[uint64] # EIP-4844 + excessBlobGas*: Opt[uint64] # EIP-4844 parentBeaconBlockRoot*: Opt[Hash32] # EIP-4788 - requestsRoot*: Opt[Hash32] # EIP-7685 + requestsHash*: Opt[Hash32] # EIP-7685 # starting from EIP-4399, `mixDigest` field is called `prevRandao` template prevRandao*(h: Header): Bytes32 = diff --git a/eth/common/transactions.nim b/eth/common/transactions.nim index 5a4c0fb2..950e043d 100644 --- a/eth/common/transactions.nim +++ b/eth/common/transactions.nim @@ -24,9 +24,9 @@ type chainId*: ChainId address*: Address nonce*: AccountNonce - yParity*: uint64 - R*: UInt256 - S*: UInt256 + v*: uint64 + r*: UInt256 + s*: UInt256 TxType* = enum TxLegacy # 0 diff --git a/eth/common/transactions_rlp.nim b/eth/common/transactions_rlp.nim index 92468f52..58121848 100644 --- a/eth/common/transactions_rlp.nim +++ b/eth/common/transactions_rlp.nim @@ -76,9 +76,9 @@ proc append*(w: var RlpWriter, x: Authorization) = w.append(x.chainId.uint64) w.append(x.address) w.append(x.nonce) - w.append(x.yParity) - w.append(x.R) - w.append(x.S) + w.append(x.v) + w.append(x.r) + w.append(x.s) proc appendTxEip7702(w: var RlpWriter, tx: Transaction) = w.startList(13) @@ -310,9 +310,9 @@ proc read*(rlp: var Rlp, T: type Authorization): T {.raises: [RlpError].} = result.chainId = rlp.read(uint64).ChainId rlp.read(result.address) rlp.read(result.nonce) - rlp.read(result.yParity) - rlp.read(result.R) - rlp.read(result.S) + rlp.read(result.v) + rlp.read(result.r) + rlp.read(result.s) proc readTxEip7702(rlp: var Rlp, tx: var Transaction) {.raises: [RlpError].} = tx.txType = TxEip7702 diff --git a/tests/common/test_transactions.nim b/tests/common/test_transactions.nim index edfa041a..525e10d6 100644 --- a/tests/common/test_transactions.nim +++ b/tests/common/test_transactions.nim @@ -26,9 +26,9 @@ const chainID: 1.ChainId, address: source, nonce: 2.AccountNonce, - yParity: 3, - R: 4.u256, - S: 5.u256 + v: 3, + r: 4.u256, + s: 5.u256 )] proc tx0(i: int): PooledTransaction =