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

feat: Implement EIP-155 (simple replay attack protection) #79

Closed
rymnc opened this issue Mar 28, 2023 · 1 comment
Closed

feat: Implement EIP-155 (simple replay attack protection) #79

rymnc opened this issue Mar 28, 2023 · 1 comment

Comments

@rymnc
Copy link
Member

rymnc commented Mar 28, 2023

EIP-155 requires the chainId to be set within the raw tx data, ref:

nim-web3/web3.nim

Lines 574 to 594 in 4c377e6

proc send*(c: ContractCallBase,
value = 0.u256,
gas = 3000000'u64,
gasPrice = 0): Future[TxHash] {.async.} =
let
web3 = c.web3
gasPrice = if web3.privateKey.isSome() or gasPrice != 0: some(gasPrice)
else: none(int)
nonce = if web3.privateKey.isSome(): some(await web3.nextNonce())
else: none(Nonce)
cc = EthSend(
data: "0x" & c.data,
source: web3.defaultAccount,
to: some(c.to),
gas: some(Quantity(gas)),
value: some(value),
nonce: nonce,
gasPrice: gasPrice)
return await web3.send(cc)

This can be worked around by manually constructing the raw tx data, and including the chainId

@jangko
Copy link
Contributor

jangko commented Dec 13, 2023

fixed by #105, closing

@jangko jangko closed this as completed Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants