Skip to content

Commit

Permalink
Fix Authorization fields name to v, r, s (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko authored Oct 15, 2024
1 parent 470baf8 commit b736906
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions eth/common/headers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
6 changes: 3 additions & 3 deletions eth/common/transactions.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions eth/common/transactions_rlp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/common/test_transactions.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit b736906

Please sign in to comment.