Skip to content

"TypeError: non-canonical s" for valid transaction #4223

Open
@ethissue

Description

@ethissue

Ethers Version

6.6.2

Search Terms

signature, yParity

Describe the Problem

A valid transaction on the Ethereum mainnet is not parseable by ethers V6. The same code snippet below will run perfectly fine with ethers v5.7.2.

Also, go-ethereum crashes on this TX in particular as well, will open an issue on their repo tomorrow too unless we figure out what's happening.

Worth noting that the TX right before and right after parse just fine!

Code Snippet

#!/bin/sh

# SET TMP PROJECT PATH
TMP_PATH=/tmp/ethissue

# SET VERSION TO BE TESTED (5.7.2 WORKS!)
VERSION="6.6.2"

# CREATE CLEAN TMP PROJECT WITH VERSION TO BE TESTED
rm -rf $TMP_PATH
mkdir -p $TMP_PATH
cd $TMP_PATH
npm init -y
npm install ethers@$VERSION

# WRITE TEST SCRIPT
cat <<EOF > "${TMP_PATH}/index.js"
const ethers = require('ethers');

const provider = ethers.getDefaultProvider();

(async function(){
    let txHash;

    //txHash = '0x6d837b8496d4ae6bfad610e6647cc66faa2d1f3676f2fca24174c1c7cc1bb233'; // block height 100,019
    txHash = '0xce8a2163e2563c7fc783371985fff9fd8194d7e27c4be1adb06520ca2e816e9a'; // block height 100,023
    //txHash = '0x92fd0b59813c1ed4ee485414a9545edfb701fc1e81ed252e00484895637c4a3f'; // block height 100,031

    const tx = await provider.getTransaction(txHash);

    console.log(tx);
})();
EOF

# RUN AND INSPECT OUTPUT
node "${TMP_PATH}/index.js"

Contract ABI

No response

Errors

TypeError: non-canonical s (argument="signature" ...)
{
  ...
  code: 'INVALID_ARGUMENT',
  argument: 'signature',
  ...
}

Environment

Ethereum (mainnet/ropsten/rinkeby/goerli), node.js (v12 or newer)

Environment (Other)

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or improvement.minor-bumpPlanned for the next minor version bump.next-patchIssues scheduled for the next arch release.on-deckThis Enhancement or Bug is currently being worked on.v6Issues regarding v6

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions